Title:
Bug 83646:CF is not generating the correct hibernate xml file for orm components
| View in TrackerStatus/Resolution/Reason: Closed/Withdrawn/
Reporter/Name(from Bugbase): garry watkins / garry watkins (Garry Watkins)
Created: 07/21/2010
Components: ORM Support
Versions: 9.0
Failure Type: Unspecified
Found In Build/Fixed In Build: 0000 /
Priority/Frequency: Trivial / Unknown
Locale/System: English / Mac 10 All
Vote Count: 0
Problem:
CF is not generating the correct hibernate xml file for orm components. Specifically, in many to one mappings where a column is specified. CF is using the PK column of the target entity as the column name. It should be using the column name of the column provided. <many-to-one class="cfc:GAITS.cfc.ITEM" column="ID_ITEM" name="item" not-found="ignore"/> <many-to-one class="cfc:GAITS.cfc.PERSON" column="ID_PERSON" name="previousCustodian" not-found="ignore"/> <many-to-one class="cfc:GAITS.cfc.PERSON" column="ID_PERSON" name="previousIssuedTo" not-found="ignore"/> <many-to-one class="cfc:GAITS.cfc.BUILDING" column="ID_BUILDING" name="previousBuilding" not-found="ignore"/> <many-to-one class="cfc:GAITS.cfc.PERSON" column="ID_PERSON" name="custodian" not-found="ignore"/> <many-to-one class="cfc:GAITS.cfc.PERSON" column="ID_PERSON" name="issuedTo" not-found="ignore"/> <many-to-one class="cfc:GAITS.cfc.BUILDING" column="ID_BUILDING" name="building" not-found="ignore"/>
Method:
Here is the source CFC.component persistent="true" {property name="id_transfer" fieldtype="id" generator="increment";property name="item" column="ITEM_ID" ormtype="integer" type="integer" fieldtype="many-to-one" cfc="ITEM" fkColumn="ID_ITEM" missingRowIgnored="true" inverse="true";property name="previousCustodian" column="PREV_CUSTODIAN_ID" ormtype="integer" type="integer" fieldtype="many-to-one" cfc="PERSON" fkColumn="ID_PERSON" missingRowIgnored="true" inverse="true";property name="previouslyIssuedTo" column="PREV_ISSUED_TO_ID" ormtype="integer" type="integer" fieldtype="many-to-one" cfc="PERSON" fkColumn="ID_PERSON" missingRowIgnored="true" inverse="true";property name="previousBuilding" column="PREV_BUILDING_ID" ormtype="integer" type="integer" fieldtype="many-to-one" cfc="BUILDING" fkColumn="ID_BUILDING" missingRowIgnored="true" inverse="true";property name="prev_location" ormtype="string" type="string";property name="custodian" column="CUSTODIAN_ID" ormtype="integer" type="integer" fieldtype="many-to-one" cfc="PERSON" fkColumn="ID_PERSON" missingRowIgnored="true" inverse="true";property name="issuedTo" column="ISSUED_TO_ID" ormtype="integer" type="integer" fieldtype="many-to-one" cfc="PERSON" fkColumn="ID_PERSON" missingRowIgnored="true" inverse="true";property name="building" column="BUILDING_ID" ormtype="integer" type="integer" fieldtype="many-to-one" cfc="BUILDING" fkColumn="ID_BUILDING" missingRowIgnored="true" inverse="true";property name="location" ormtype="string" type="string";property name="transfer_date" ormtype="timestamp" type="timestamp";property name="comments" ormtype="string" type="string";property name="created_by" ormtype="string" type="string";property name="when_created" ormtype="timestamp" type="timestamp";public string function getIDName() {var id = StructFindValue( GetMetaData(This), "id")[1].owner.name;return id;}public any function getIDValue() {return variables[getIDName()];}public void function setIDValue(any idvalue) {variables[getIDName()] = arguments.idvalue;}public void function nullifyZeroID() {if (getIDValue() eq 0){variables[getIDName()] = JavaCast("Null", "");}}}Here is the .hbmxml note the many to one<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"><hibernate-mapping> <class entity-name="transfer" lazy="true" name="cfc:GAITS.cfc.transfer" table="transfer"> <id name="id_transfer" type="int"> <column length="10" name="ID_TRANSFER"/> <generator class="increment"/> </id> <property name="prev_location" type="string"> <column name="PREV_LOCATION"/> </property> <property name="location" type="string"> <column name="LOCATION" not-null="true"/> </property> <property name="transfer_date" type="timestamp"> <column name="TRANSFER_DATE" not-null="true"/> </property> <property name="comments" type="string"> <column name="COMMENTS"/> </property> <property name="created_by" type="string"> <column name="CREATED_BY" not-null="true"/> </property> <property name="when_created" type="timestamp"> <column name="WHEN_CREATED" not-null="true"/> </property> <many-to-one class="cfc:GAITS.cfc.ITEM" column="ID_ITEM" name="item" not-found="ignore"/> <many-to-one class="cfc:GAITS.cfc.PERSON" column="ID_PERSON" name="previousCustodian" not-found="ignore"/> <many-to-one class="cfc:GAITS.cfc.PERSON" column="ID_PERSON" name="previouslyIssuedTo" not-found="ignore"/> <many-to-one class="cfc:GAITS.cfc.BUILDING" column="ID_BUILDING" name="previousBuilding" not-found="ignore"/> <many-to-one class="cfc:GAITS.cfc.PERSON" column="ID_PERSON" name="custodian" not-found="ignore"/> <many-to-one class="cfc:GAITS.cfc.PERSON" column="ID_PERSON" name="issuedTo" not-found="ignore"/> <many-to-one class="cfc:GAITS.cfc.BUILDING" column="ID_BUILDING" name="building" not-found="ignore"/> </class></hibernate-mapping>I manually fixed the hbmxml file for these settings: <many-to-one class="cfc:GAITS.cfc.ITEM" column="ITEM_ID" name="item" not-found="ignore"/> <many-to-one class="cfc:GAITS.cfc.PERSON" column="PREV_CUSTODIAN_ID" name="previousCustodian" not-found="ignore"/> <many-to-one class="cfc:GAITS.cfc.PERSON" column="PREV_ISSUED_TO_ID" name="previouslyIssuedTo" not-found="ignore"/> <many-to-one class="cfc:GAITS.cfc.BUILDING" column="PREV_BUILDING_ID" name="previousBuilding" not-found="ignore"/> <many-to-one class="cfc:GAITS.cfc.PERSON" column="CUSTODIAN_ID" name="custodian" not-found="ignore"/> <many-to-one class="cfc:GAITS.cfc.PERSON" column="ISSUED_TO_ID" name="issuedTo" not-found="ignore"/> <many-to-one class="cfc:GAITS.cfc.BUILDING" column="BUILDING_ID" name="building" not-found="ignore"/>
Result:
Repeated column in mapping for entity: transfer column: ID_PERSON (should be mapped with insert="false" update="false") Resources:Check the ColdFusion documentation to verify that you are using the correct syntax.Search the Knowledge Base to find a solution to your problem.Browser Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-us) AppleWebKit/533.16 (KHTML, like Gecko) Safari/412.0Remote Address 0:0:0:0:0:0:0:1%0Referrer Date/Time 21-Jul-10 10:07 AMStack Traceorg.hibernate.MappingException: Repeated column in mapping for entity: transfer column: ID_PERSON (should be mapped with insert="false" update="false")at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:676)at org.hibernate.mapping.PersistentClass.checkPropertyColumnDuplication(PersistentClass.java:698)at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:720)at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:474)at org.hibernate.mapping.RootClass.validate(RootClass.java:236)at org.hibernate.cfg.Configuration.validate(Configuration.java:1193)at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1378)at coldfusion.orm.hibernate.HibernateConfiguration.buildSessionFactory(HibernateConfiguration.java:485)at coldfusion.orm.hibernate.HibernateProvider.InitializeORMForApplication(HibernateProvider.java:182)at coldfusion.orm.hibernate.HibernateProvider.beforeApplicationStart(HibernateProvider.java:79)at coldfusion.filter.ApplicationFilter.fireBeforeAppStartEvent(ApplicationFilter.java:504)at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:239)at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)at coldfusion.filter.PathFilter.invoke(PathFilter.java:94)at coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:27)at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70)at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46)at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)at coldfusion.filter.CachingFilter.invoke(CachingFilter.java:62)at coldfusion.CfmServlet.service(CfmServlet.java:200)at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)at jrun.servlet.FilterChain.service(FilterChain.java:101)at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)at jrun.servlet.http.WebService.invokeRunnable(WebService.java:172)at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3041800
External Customer Info:
External Company:
External Customer Name: garry watkins
External Customer Email: 44AA11BE4624E368992015A8
External Test Config: 07/21/2010
Attachments:
Comments: