Hi,
I've spent all the day searching for the mistake or some solution. Read all the available books/forums... Cannot understand what's happening.
Here's the situation:.
Mappings:
Code:
<hibernate-mapping default-access="property">
<class name="com.sns.ukrsov.domain.Cartcontainer" table="cartcontainer" catalog="ukrsovcat" >
<id name="cartId" type="string">
<column name="cartId" length="128" not-null="true"/>
<generator class="uuid" />
</id>
<property name=... skipped >
<set name="cartitems" cascade="save-update,delete" inverse="true">
<key column="parentCartid" not-null="true"/>
<one-to-many class="com.sns.ukrsov.domain.Cartitems" />
</set>
</class>
</hibernate-mapping>
<hibernate-mapping default-access="property">
<class name="com.sns.ukrsov.domain.Cartitems" table="cartitems" catalog="ukrsovcat" proxy="com.sns.ukrsov.domain.CartitemsIntf">
<id name="itemid" type="string">
<column name="itemid" length="128" />
<generator class="uuid"/>
</id>
<property name="... skipped >
<many-to-one name="parentCartid" class="com.sns.ukrsov.domain.Cartcontainer"
column="parentCartid" not-null="true"></many-to-one>
</hibernate-mapping>
Corresponding classes defined with interfaces.
Loading is done using the code
Code:
Session session = getSession();
CartcontainerIntf cartToReturn = (CartcontainerIntf) session.load(Cartcontainer.class, cartId);
//Hibernate.initialize(cartToReturn);
Set<Cartitems> cItems = cartToReturn.getCartitems();
Iterator iterator = cItems.iterator();
while(iterator.hasNext()) {
iterator.next();
}
//Hibernate.initialize(cItems);
session.close();
return cartToReturn;
And the error/debug log from hib is
Code:
2011-04-15 14:41:54,585 ERROR [org.hibernate.property.BasicPropertyAccessor] - IllegalArgumentException in class: com.sns.ukrsov.domain.Cartitems, setter method of property: parentCartid
2011-04-15 14:41:54,585 ERROR [org.hibernate.property.BasicPropertyAccessor] - expected type: java.lang.String, actual value: com.sns.ukrsov.domain.Cartcontainer_$$_javassist_4
2011-04-15 14:42:00,203 WARN [org.springframework.web.portlet.DispatcherPortlet] - Handler execution resulted in exception - forwarding to resolved error view
org.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling setter of com.sns.ukrsov.domain.Cartitems.parentCartid
at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:128)
It's starting to drive me crazy... Tried. probably, everything.... Uni-directional is working ok.
Javassist is in place, besides this everything else seems to be working ok - creating new parent item, add some child items, and it is being saved altogether in a single command with all the keys....
Well, I think the hib debug info displays the cause - I just can't understand where to look any further.
Thanks in advance!