I am trying to obtain the nexval in a sequence from a generator in Firebird.
Configuration cfg = new Configuration().addClass( com.nash.value.Contact.class );
SessionFactory sessions = cfg.buildSessionFactory();
Session sess = sessions.openSession(); // obtain a JDBC connection and
Transaction trans = sess.beginTransaction();
Contact contact = new Contact();
contact.setFirstName( "foo" );
contact.setLastName( "bar" );
sess.save( contact );
trans.commit();
The debug shows that the next value is obtained, however, an exception is thrown:
net.sf.hibernate.HibernateException: identifier of an instance of com.nash.value.Contact altered from 10604 to 10604 ...
The documentation says that using a sequence requires two SQL queries to insert a new object. Can someone give me an example of how to insert a new record in a table using a sequence?
TIA
|