-->
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.  [ 2 posts ] 
Author Message
 Post subject: Calling MySql 5.0 stored procedure
PostPosted: Thu Sep 28, 2006 7:46 am 
Newbie

Joined: Fri Aug 04, 2006 3:16 am
Posts: 3
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
Hibernate 3.2



Code between sessionFactory.openSession() and session.close():
PreparedStatement st = session.connection().prepareStatement("{call changeAllDiffProdGroup(?,?,?,?,?)}");
st.setString(1,dgr);
st.setString(2,pgr);
st.setString(3,text);
st.setFloat(4,updatedDifference);
st.setInt(5,productMngrId);

boolean hasResults = st.execute();


List productGroupList=session.createQuery("from ProductGroup prod left join fetch prod.discountGroup where prod.discountGroup.dgr like '"+dgr+"%' and prod.pgr like '"+pgr+"%' and prod.text Like '"+text+"%' order by prod.pgr").list();



Full stack trace of any exception that occurs:
org.hibernate.exception.GenericJDBCException: could not execute query



Name and version of the database you are using:
Mysql 5.0

The error
If we call the prepared statement , the procedure gets executed and the
database gets updated. There is no exception being thrown. But when we try
to refresh the session cache by doing a HQL query it throws a GenericJDBCException


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 28, 2006 11:47 am 
Regular
Regular

Joined: Tue Sep 26, 2006 11:37 am
Posts: 115
Location: Sacramento, CA
Do you commit the transaction in the stored procedure? In this case Hibernate will try to run a query outside a transaction and mysql will bomb.

Marius


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.