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?)