Status/Resolution/Reason: Closed/Fixed/
Reporter/Name(from Bugbase): barnaby relph / Barnaby Relph (ybanrab)
Created: 02/13/2009
Components: Documentation, General
Versions: 9.0
Failure Type: Unspecified
Found In Build/Fixed In Build: 0000 /
Priority/Frequency: Major / Unknown
Locale/System: English / Mac 10 All
Vote Count: 0
Problem:
I get an error when attempting to use a many-to-one relationship. Attempting to load an object with a many-to-one property generates a java.lang.NullPointerException
Method:
User.cfc
<cfcomponent persistent="true" hint="Represents a user of the Blog" output="false" table="tblusers">
<cfproperty name="username" type="string" fieldType="id" generator="assigned">
<cfproperty name="password" type="string">
<cfproperty name="name" type="string">
</cfcomponent>
Entry.cfc
<cfcomponent hint="Represents an Entry in a Blog" output="false" persistent="true" table="tblblogentries">
<cfproperty name="id" fieldType="id" generator="guid" type="uuid">
<cfproperty name="title" type="string">
<cfproperty name="body" type="string">
<cfproperty name="posted" type="date">
<cfproperty name="morebody" type="string">
<cfproperty name="alias" rtpe="string">
<cfproperty name="username" fieldType="many-to-one" cfc="BlogORM.model.User" column="username" mappedby="username" FKcolumn="username" lazy="true">
<cfproperty name="blog" type="string">
<cfproperty name="allowcomments" type="boolean">
<cfproperty name="enclosure" type="string">
<cfproperty name="filesize" type="numeric">
<cfproperty name="mimetype" type="string">
<cfproperty name="views" type="numeric">
<cfproperty name="released" type="boolean">
<cfproperty name="mailed" type="boolean">
<cfproperty name="summary" type="string">
<cfproperty name="subtitle" type="string">
<cfproperty name="keywords" type="string">
<cfproperty name="duration" type="string">
<cfproperty name="categories" fieldtype="many-to-many" cfc="Category" linktable="tblblogentriescategories" FKColumn="entryidfk" inversejoincolumn="categoryidfk" collectiontype="array">
</cfcomponent>
My application code causes an error on the following line:
<cfset entries=EntityLoad("BlogORM.model.Entry")>
Result:
java.lang.NullPointerException
at org.hibernate.persister.entity.AbstractEntityPersister.loadByUniqueKey(AbstractEntityPersister.java:1649)
at org.hibernate.type.EntityType.loadByUniqueKey(EntityType.java:608)
at org.hibernate.type.EntityType.resolve(EntityType.java:382)
at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:120)
at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:854)
at org.hibernate.loader.Loader.doQuery(Loader.java:729)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.doList(Loader.java:2213)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
at org.hibernate.loader.Loader.list(Loader.java:2099)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at coldfusion.orm.hibernate.HibernatePersistenceManager.load(HibernatePersistenceManager.java:145)
at coldfusion.orm.ORMUtils.entityLoad(ORMUtils.java:65)
at coldfusion.runtime.CFPage.EntityLoad(CFPage.java:7163)
at cfindex2ecfm2009287933.runPage(/Applications/ColdFusionCentaur/wwwroot/BlogORM/index.cfm:1)
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3037553
External Customer Info:
External Company:
External Customer Name: Barnaby Relph
External Customer Email: 15567101450938F3992015A9
External Test Config: 02/13/2009
Attachments:
Comments: