[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3689?page=c...
]
Paul Benedict commented on HHH-3689:
------------------------------------
This issue is not just related to composite elements. I got this using Hibernate 3.3.1 and
Annotations 3.4. I will try to provide a test case.
NPE when using composite-map-key and composite-element together in a
map
------------------------------------------------------------------------
Key: HHH-3689
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3689
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.1
Environment: 3.3.1, MySQL 5
Reporter: Jason Maskell
When trying to get a composite map key working with my composite element class, I ran
into this issue. I've seen it reported in a couple of other places since August 08, so
it's been around for a while.
<map name="inventory" table="capo_inventory">
<key column="capo_id"/>
<composite-map-key class="ItemCountKey">
<key-many-to-one name="item" column="item_id"
class="Item"/>
<key-property name="quality" type="int"
column="quality" />
</composite-map-key>
<composite-element class="ItemCount">
<many-to-one name="item" class="com.tamedtornado.data.Item"
formula="item_id" />
<property name="quality" formula="quality"
type="int" />
<property name="count" type="int" />
</composite-element>
</map>
This mapping causes this error (root cause):
Caused by: java.lang.NullPointerException
at org.hibernate.util.StringHelper.qualify(StringHelper.java:287)
at org.hibernate.util.StringHelper.qualify(StringHelper.java:301)
at org.hibernate.loader.JoinWalker.walkCompositeElementTree(JoinWalker.java:522)
at org.hibernate.loader.JoinWalker.walkCollectionTree(JoinWalker.java:333)
at org.hibernate.loader.JoinWalker.walkCollectionTree(JoinWalker.java:278)
at
org.hibernate.loader.collection.BasicCollectionJoinWalker.<init>(BasicCollectionJoinWalker.java:70)
at
org.hibernate.loader.collection.BasicCollectionLoader.<init>(BasicCollectionLoader.java:76)
at
org.hibernate.loader.collection.BasicCollectionLoader.<init>(BasicCollectionLoader.java:63)
at
org.hibernate.loader.collection.BasicCollectionLoader.<init>(BasicCollectionLoader.java:54)
at
org.hibernate.loader.collection.BatchingCollectionInitializer.createBatchingCollectionInitializer(BatchingCollectionInitializer.java:115)
at
org.hibernate.persister.collection.BasicCollectionPersister.createCollectionInitializer(BasicCollectionPersister.java:320)
at
org.hibernate.persister.collection.AbstractCollectionPersister.postInstantiate(AbstractCollectionPersister.java:563)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:326)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
at
org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:814)
at
org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:732)
at
org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
... 65 more
It's quite easy to debug, but I have no idea what it's supposed to be doing, so
have no idea how to fix it. The String[] cols parameter passed into
walkCompositeElementTree has two nulls in it, which causes the NPE later in the stack. I
hope this is easily reproducible, as I'm going to have to write some really grodey
code now that I can't easily find my object by those two parameters. :)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira