hello experts,
[b]Hibernate version:[/b]
Hibernate Annotations 3.3.1.GA
Hibernate 3.2.6
below is the typical method trying to insert a record into Sybase DB. This works fine when I insert a brand new record, but when I want to insert the following records the save method of the session allocates the same auto generated id of the previously created object (found out when running the app in debug mode). And on top of this the sql hibernate outputs the proper insert statements on to the console without reporting any errors.
And when I looking into the database except the first record remaining all are missing in the Dbase server.
Anyone experienced this b4 in the past?
[code]
public void xxxxxx(SomeObject object) {
Object owner = HibernateSessionManager.createSession();
Transaction t = HibernateSessionManager.getSession().beginTransaction();
try {
SomeObjectDAO dao = new SomeObjectDAO();
dao.create(object);
t.commit();
} catch (ConstraintViolationException cve) {
if(t.isActive()) {
t.rollback();
}
} catch (HibernateException he) {
if(t.isActive()) {
t.rollback();
}
throw he;
} catch (Throwable he) {
if(t.isActive()) {
t.rollback();
}
throw new RuntimeException(he);
} finally {
HibernateSessionManager.closeSession(owner);
}
}
[/code]
any input will be appreciated,
thanks
Krish.
|