My Friends,
I've a complicated component mapped object to a table.
For example,
<class name="Foo" table="fatfoo">
<id column="sid" type="long" /> <!-- NOTE THAT I havenot specified name -->
<component name="bar" class="Bar" access="field">
<property name="sid" column="sid" type="long" insert="false" update="false" not-null="true" access="field" />
</component>
</class>
Class
Code:
class Foo{
Bar bar;
}
class Bar{
long sid; // this is the id mapped
}
if i update it as
Code:
session.update(foo);
it works fine in unit tests,
The problem starts when I run in managed environment with multiple requests, hibernate issues runtime exception stating "The class has no identifier property".
I got the problem and changed my code as
Code:
session.update(foo, new Long(foo.bar.sid));
it works fine.
I'm very curious about this behaviour. Actually i was unable to produce this problem by a test. Is there any way i can reproduce it in a test??
Please explain,
Thanks,