-->
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: java.sql.SQLException: Syntax error in ItemTest
PostPosted: Fri Mar 25, 2005 1:12 pm 
Beginner
Beginner

Joined: Fri Mar 12, 2004 5:18 pm
Posts: 44
Hi,

I am trying to run the ItemTest of CaveatEmptor in the following setting:
MySQL 4.0.22
driver 3.0.16.ga


But I got an java.sql.SQLException: Syntax error

And the exception occurs in this line of ItemDAO:
Code:

public Bid getMaxBid(Long itemId) {
//...
   maxBidAmount = (Bid) q.uniqueResult();
//....

}


Can someone please tell me

Code:

11:07:59,228 ERROR JDBCExceptionReporter: Could not execute query
java.sql.SQLException: Syntax error or access violation message from server: "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 'select min(bid1_.AMOUNT) from BID bid1_ where (bid1_.ITEM_ID=2 "
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1997)
   at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1167)
   at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1278)
   at com.mysql.jdbc.Connection.execSQL(Connection.java:2251)
   at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1586)
   at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:87)
   at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:875)
   at net.sf.hibernate.loader.Loader.doQuery(Loader.java:269)
   at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
   at net.sf.hibernate.loader.Loader.doList(Loader.java:1033)
   at net.sf.hibernate.loader.Loader.list(Loader.java:1024)
   at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:854)
   at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1544)
   at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)
   at net.sf.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:550)
   at org.hibernate.auction.dao.ItemDAO.getMaxBid(ItemDAO.java:51)
   at org.hibernate.auction.test.ItemTest.testPlaceBid(ItemTest.java:40)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:324)
   at junit.framework.TestCase.runTest(TestCase.java:154)
   at org.hibernate.auction.test.TestCase.runTest(TestCase.java:17)
   at junit.framework.TestCase.runBare(TestCase.java:127)
   at junit.framework.TestResult$1.protect(TestResult.java:106)
   at junit.framework.TestResult.runProtected(TestResult.java:124)
   at junit.framework.TestResult.run(TestResult.java:109)
   at junit.framework.TestCase.run(TestCase.java:118)
   at junit.framework.TestSuite.runTest(TestSuite.java:208)
   at junit.framework.TestSuite.run(TestSuite.java:203)
   at junit.textui.TestRunner.doRun(TestRunner.java:116)
   at junit.textui.TestRunner.doRun(TestRunner.java:109)
   at junit.textui.TestRunner.run(TestRunner.java:72)
   at org.hibernate.auction.test.ItemTest.main(ItemTest.java:104)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 25, 2005 2:50 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Don't use MySQL or use a different version that supports this SQL query. Also, apply the debugging techniques in "How to ask for help" before posting.


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.