I am trying to map collections of value types by using idbag:
on the bean:
ArrayList images = new ArrayList();
the idbag mapping as:
<idbag name="images" lazy="true" table="Image">
<collection-id type="long" column="imageID">
<generator class="native"/>
</collection-id>
<key column="FK_itemID"/>
<element type="string" column="fileName" not-null="true"/>
</idbag>
When I save the object I get this error:
org.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of com.ja.collection.entity.item.idbag.Item.setImages
at org.hibernate.tuple.PojoEntityTuplizer.setPropertyValuesWithOptimizer(PojoEntityTuplizer.java:215)
at org.hibernate.tuple.PojoEntityTuplizer.setPropertyValues(PojoEntityTuplizer.java:185)
.....
Question:
Based on what I learnt from google searches, it is caused by hibernate during trying to set on bean -- I could be wrong.
So in this case, is it caused by hibernate trying to set the generated imageID to the value object? if so, but in this case, the value object is an string.
Thanks!
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using:
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
Problems with Session and transaction handling?
Read this:
http://hibernate.org/42.html