[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3831?page=c...
]
Sandeep Vaid commented on HHH-3831:
-----------------------------------
I also found one more thing...
Say productid='1'
While trying to get the HashCode(), it goes to
AbstractComponentTuplizer :
public Object getPropertyValue(Object component, int i) throws HibernateException {
return getters[i].get( component ); //on this line it throes exception
}
this getter array only contains my 2 fields viz. useType and startTimeStamp... It
doesn't contain the productId (which is generated foreign key)...
Now i guess when it tries to find productId=1 in getter at 0th index, it doesn't find
that and throwsexception....
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