[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2060) To be able to use <generator> with <composite-id>

Sandeep Vaid (JIRA) noreply at atlassian.com
Wed Mar 25 08:45:40 EDT 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2060?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=32707#action_32707 ] 

Sandeep Vaid commented on HHH-2060:
-----------------------------------

My scenario is also similar...
http://forum.hibernate.org/viewtopic.php?t=995903&sid=1e523284ccc4b1c724e5aef5feb0c494

When i try to save Product (with cascade save for ProductBasic), i get the following error:

org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of com.tietoenator.lis.db.impl.product.bo.CompProductBasicBO.useType
	at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:171)
	at org.hibernate.tuple.component.AbstractComponentTuplizer.getPropertyValue(AbstractComponentTuplizer.java:64)
	at org.hibernate.tuple.component.AbstractComponentTuplizer.getPropertyValues(AbstractComponentTuplizer.java:70)
	at org.hibernate.tuple.component.PojoComponentTuplizer.getPropertyValues(PojoComponentTuplizer.java:86)
	at org.hibernate.type.ComponentType.getPropertyValues(ComponentType.java:353)
	at org.hibernate.type.ComponentType.getHashCode(ComponentType.java:184)
	at org.hibernate.engine.EntityKey.generateHashCode(EntityKey.java:104)
	at org.hibernate.engine.EntityKey.<init>(EntityKey.java:48)
	at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:161)


I guess as i have used composite id and <generator class="foreign"> inside that, it treats it as component and when it tries to get a unique key for the instance using hashmap(), it throws exception..
I guess this is a bug in hibernate core...
I have checked this with Hibernate 3.2.6 and Hibernate 3.3.1 as well

> To be able to use <generator> with <composite-id>
> -------------------------------------------------
>
>                 Key: HHH-2060
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2060
>             Project: Hibernate Core
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 3.2.0.cr4
>         Environment: Hibernate 3.x
>            Reporter: Xavier Brénuchon
>            Assignee: Steve Ebersole
>             Fix For: 3.3.0.CR2
>
>         Attachments: hibernate.core.trunk.core.patch, hibernate.core.trunk.testsuite.patch
>
>
> Hello, 
> This is the continuation of HB-389
> We develop an application which has very strong need for performance with several tens of million recordings. Partitioning is a need.
> So for that, I use <composite-id>. But my primary key is not a natural key, but a real technical key :
>  - column of partitioning for optimization of the data base 
>  - column of technical id
> So I need to have a generator, for exemple :
>     <composite-id name="id" class="IdPartition">
>         <key-property name="org" type="string" column="ORG"/>
>         <key-property name="id" type="long" column="ID"/>
>         <generator class="fr.test.xavier.IdPartitionGenerator">
>             <param name="table">TAB_SEQ</param>
>             <param name="column">LAST</param>
>         </generator>
>     </composite-id>
> The good news is that Hibernate can use that (HB-389).
> In fact, it is enough to modify the DTD to authorize <generator> in <composite-id> and it is all. The current code of Hibernate manages it very well. 
> Is it possible that Hibernate is enriched by this functionality?

-- 
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.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       




More information about the hibernate-issues mailing list