-->
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.  [ 5 posts ] 
Author Message
 Post subject: session.createQuery(.... - problem.
PostPosted: Fri Feb 06, 2009 9:28 am 
Newbie

Joined: Fri Feb 06, 2009 9:14 am
Posts: 3
Hi All,

I am using Hibernate 3.0, I have created a session and in the same session when I am executing 'session.createQuery(...' third time it is producing an error 'Could not execute JDBC batch update'. but first two times it executes successfully.

The code is:

[code]List list = session.createQuery("from "+Sequence.class.getName()+" where sequenceID=:sequenceID")
.setString("sequenceID",sequenceID)
.list();

Your reply will be highly appreciated.

Thanks in advance.
Hemant.


Last edited by hemant2323 on Fri Feb 06, 2009 9:34 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 06, 2009 9:32 am 
Expert
Expert

Joined: Fri Jan 30, 2009 1:47 am
Posts: 292
Location: Bangalore, India
Are you sure you are executing this query only and this query is causing the exception?

_________________
Regards,
Litty Preeth


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 06, 2009 10:08 am 
Newbie

Joined: Fri Feb 06, 2009 9:14 am
Posts: 3
message


Last edited by hemant2323 on Fri Feb 06, 2009 10:18 am, edited 2 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 06, 2009 10:10 am 
Newbie

Joined: Fri Feb 06, 2009 9:14 am
Posts: 3
Hi littypreethkr,

Yes, the scenario is like

HibernateUtil.getSessionFactory BugTrackerConstants.FILE_BUGTRACKER);
Session session = HibernateUtil.currentSession();
transaction=session.beginTransaction();
........
session.createQuery(....//same Query
........
session.save(a)
.........
session.createQuery(.... //same Query --OK
........
session.save(b)
.........
session.createQuery(.... //Same Query --OK
........
session.save(c)
.........
session.createQuery(....//Same Query -- Problem/error
........
session.save(d)
.........
transaction.commit();
HibernateUtil.closeSession();


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 07, 2009 2:18 am 
Expert
Expert

Joined: Fri Jan 30, 2009 1:47 am
Posts: 292
Location: Bangalore, India
Oh I see.... Your are querying, making some changes and saving.... Well there could be some issue with the update which is violating something... Can you post the actions you are doing and the stack trace?

_________________
Regards,
Litty Preeth


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

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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.