Hibernate version: 2.1.6
hi,
i've got a little 'problem' and i really hope there's a workaround for it ...
I've got a Class A with many-to-one relationships to Classes B,C and D. Relations are via 'simple'- and 'composite'- ids.
Everything works perfect on my test-database (a db2 on as400).
But on the pre-production db, there're exceptions during loading ...
My problem:
All relationships can be 'null', so the field in the db is 'null' (and that works perfectly).
But ... and i really don't know why it's solved like that, in (pre-)production-db there isn't a 'null-value' in the field ... instead of, there's a '0' :( And i'm absolutly not allowed to change this ...
So hibernate 'thinks' (and i would do the same), that there must be an entry in the associated table and throws an exception (net.sf.hibernate.UnresolvableObjectException), because there isn't an entry because '0' means 'null' in this special case ...
Is there a workaround to define '0' as 'null'?
Somethink like:
Code:
<many-to-one ... not-null="false">
<column name="col1" null-value="0"/>
<column name="col2"/>
</many-to-one>
I really hope, that i only have overread something and that's not a problem ...
I've tried solving the problem with an Interceptor or liflecyle-methods, but that won't work ....
I hope somebody can help a little bit ...
thx!
curio