Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3.2
Mapping documents:
<hibernate-mapping>
<class name="example.MyClass" table="my_table">
<id name="id" column="ID" type="long" unsaved-value="0">
<generator class="identity"/>
</id>
</class>
</hibernate-mapping>
I'm trying to persist the class in 2 databases, in one, I need to use the identity to populate the ID. In the second database, I'm trying to assign the object it's ID first, so for the first database, everything works great
Currently, if I do the following in the second database:
MyClass myObject=new MyClass();
myObject.setId(100);
session.save(myObject);
The Id of 100 will be overwritten with the identity value.
Is there any way to over-ride the fact that the mapping file said to use an identity?