Hi,
I'm having a problem with loading an object from the database with an undefined id value. The row is in the table but when I do a get () with the id, I receive a null. My guess is this is because of the undefined value for the id. I can't use a version identifier because the object is first created from SAP without a version and I use the same id as SAP to save it to another db.
Any solution or workaround to this problem? Or some part of the reference I should read again...
Hibernate version:
3.02
Mapping documents:
Code:
<hibernate-mapping package="cz.vsb.phonebook.model.pasport">
<class name="Areal" table="Areal" select-before-update="true" lazy="false">
<id name="id" type="long" column="areal_id" unsaved-value="undefined">
</id>
<property name="name" column="name"/>
<many-to-one name="address" column="address_id" not-null="true"/>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
s.get (Areal.class, new Long (areal.getId ());