hibernate - ColdFusion ORM is loading base component rather than derived component? -
let's have request
base component , requesta
, requestb
subclasses mapped using table per subclass, without discriminator.
we did entityloadbypk('request', somesubclassentityid)
, method return instance of requesta
or requestb
component.
somehow, stopped behaving morning , code haven't changed @ all. entityloadbypk
function return instances of request
rather derived components.
to make sure code did not changed, copy-pasted entire application on coldfusion box (running cf11) , behaved used on our cf9 box.
obviously, there must setting or have changed on cf9 box, looked @ think off , cannot find explanation.
the problem still persists after rebooted server , cleared possible caches think of (template cache, component cache, , called ormevictqueries , ormevictentity).
here's orm settings:
<cfset this.ormsettings = { dialect = 'microsoftsqlserver', eventhandling = true, flushatrequestend = false, logsql = true, savemapping = false, cfclocation = domainmodellocation }>
here's mapping example (i stripped unnecessary relations):
<!--- ipsrequest.cfc ---> <cfcomponent persistent="true" table="ipsrequest" lazy="no"> <cfproperty name="id" type="numeric" fieldtype="id" column="id" generator="assigned"> </cfcomponent> <!--- ipsinfomanfiletracerrequest.cfc ---> <cfcomponent persistent="yes" extends="ipsrequest" table="ipsinfomanfiletracerrequest" joincolumn="ips_request_id"> <!--- id property repeated because of bug ---> <cfproperty name="id" type="numeric" fieldtype="id" column="ips_request_id" generator="assigned"> </cfcomponent>
here's generated mappings cf9 box:
<!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="ipsrequest" lazy="false" name="cfc:charities.cts.cfc.model.ips.request.ipsrequest" table="ipsrequest"> <id name="id" type="int"> <column length="10" name="id"/> <generator class="assigned"/> </id> </class> </hibernate-mapping> <!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="infomanfiletracerrequest" lazy="true" name="cfc:charities.cts.cfc.model.ips.request.infomanfiletracerrequest" table="ipsinfomanfiletracerrequest"> <id name="id" type="int"> <column length="10" name="ips_request_id"/> <generator class="assigned"/> </id> </class> </hibernate-mapping>
here's mappings generated on cf11 box same code:
<!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="ipsrequest" lazy="false" name="cfc:charities.cts.cfc.model.ips.request.ipsrequest" table="ipsrequest"> <id name="id" type="int"> <column length="10" name="id"/> <generator class="assigned"/> </id> </class> </hibernate-mapping> <!doctype hibernate-mapping public "-//hibernate/hibernate mapping dtd 3.0//en" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <joined-subclass entity-name="infomanfiletracerrequest" extends="cfc:charities.cts.cfc.model.ips.request.ipsrequest" lazy="true" name="cfc:charities.cts.cfc.model.ips.request.infomanfiletracerrequest" table="ipsinfomanfiletracerrequest"> <key column="ips_request_id"/> </joined-subclass> </hibernate-mapping>
we can see mappings seems incorrect on cf9 box, used work fine same code.
the latest hotfix applied on cf9 box hf902-00007.jar
, done in 2014.
i must i'm puzzled , have no idea have changed behavior?
edit:
we upgraded our cf9 box cf11 , problem went away, despite fact used migration tool import configuration settings.
we happy did fix problem, worried of not knowing affected behavior , see how fragile coldfusion can be.
our production box still runs on cf9 now...
Comments
Post a Comment