-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Hibernate outputs sql statements, but no records in DB.
PostPosted: Mon Sep 15, 2008 12:11 pm 
Newbie

Joined: Mon Sep 15, 2008 11:56 am
Posts: 1
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.