-->
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: Recent error (call working before). MySQL Stored Procedure
PostPosted: Fri Apr 03, 2009 11:48 pm 
Newbie

Joined: Mon Jul 03, 2006 4:28 pm
Posts: 15
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.3.1.GA

Mapping documents: Annotated stored procedures. Has started happening on all stored procedures simultaneously after recent upgrade.

Example:
@NamedNativeQuery(
name="industryNLAnalysisBatchRun",
resultSetMapping="valueMapping",
query="{call sp_industryNLAnalysisBatchRun()}",
hints={
@QueryHint(name="org.hibernate.callable", value="true")
}
)

Code between sessionFactory.openSession() and session.close():
Using entity manager:

Query q = em.createNamedQuery("industryNLAnalysisBatchRun");
q.getSingleResult();

Full stack trace of any exception that occurs:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'limit 2' at line 1


Name and version of the database you are using:

MySql 5.1.32 community via MySQLJ Connector 5.1.7

Hibernate Persistence.xml properties:
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.show_sql" value="true" />


The generated SQL (show_sql=true):

It's just putting limit=? on the end of all my stored procedure calls (then I'm guessing setting the ? to 2)

This is a recent phenomenon. Previously I was calling q.getSingleResult() to get a single result back from a MySQL stored proc and everything was working fine...upgraded from 3.2 to 3.3.1 and all those calls now don't work. But q.getResultList() works fine? (so I'm in the middle of changing all my calls :-| ). Anyone know why q.getSingleResult stopped working (started adding the limit statement to the sproc calls?)


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