composite-id + generator +foreign
---------------------------------
Key: HHH-3831
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3831
Project: Hibernate Core
Issue Type: Bug
Components: core
Reporter: Sandeep Vaid
Attachments: ProductAndProductBasicDetails.txt, ProductAndProductBasicError.txt
I have 2 classes viz. Product and ProductBasic which has one-to-one relationship.
Product is mapped to a table PRODUCT which has PRODUCTID as PK.
ProductBasic is mapped to a table PRODUCTBASIC which has PRODUCTID,USETYPE and
STARTTTIMESTAMP as composite key. Also PRODUCTID
is the foreign key referencing PRODUCT table...
When i am saving Product (with cascade for ProductBasic):
For Product, it's taking persister.identifierType as org.hibernate.type.CustomType
For ProductBasic, it's taking persister.identifierType as
org.hibernate.type.ComponentType
Assume productId='1'
When i call session.save(product),
a) For Product: it tries to find hashmap of id=1 using
org.hibernate.type.StringType.getHashCode() which comes out to be 49 (ASCII)..
b) For ProductBasic: it tries to find hashmap of id=1 using
org.hibernate.type.ComponentType.getHashCode() and throws exception:
org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of
com.tietoenator.lis.db.impl.product.bo.CompProductBasicBO.useType
Does it treating ProductBasic as component because it's productId value depends upon
Product.productId? Even if it treats
ProductBasic as component, why it is not fetching the proper hashCode() and throwing
exception?
--
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