-->
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: My 1st List (session.find) query
PostPosted: Thu Jul 22, 2004 4:10 am 
Newbie

Joined: Thu Jul 22, 2004 4:01 am
Posts: 1
Location: SF
Hello,
I am having a lot of trouble making my first list query. I know hibernate is set up correctly because I can insert and get values from the db. My problems start when I use the session.find and session.createQuery. The simplest example I could find was session.find("from CLASSNAME"); where CLASSNAME is the name of my object.

It seems the SQL generated is incorect or my persister(?) is not right.

Hibernate generates the following sql

Hibernate: select mediaitem0_.mediaId as mediaId, mediaitem0_.desc as desc, mediaitem0_.label as label from media mediaitem0_

I have tried this sql in the MySQL query analyzer and it fails there too. Any ideas?



Joe



2953 [http8080-Processor1] WARN util.JDBCExceptionReporter - SQL Error: 1064, S
QLState: 42000
2953 [http8080-Processor1] ERROR util.JDBCExceptionReporter - Syntax error or a
ccess violation message from server: "You have an error in your SQL syntax. Che
ck the manual that corresponds to your MySQL server version for the right syntax
to use near 'desc, mediaitem0_.label as label from media mediaitem0_' at lin"
2953 [http8080-Processor1] WARN util.JDBCExceptionReporter - SQL Error: 1064, S
QLState: 42000
2953 [http8080-Processor1] ERROR util.JDBCExceptionReporter - Syntax error or a
ccess violation message from server: "You have an error in your SQL syntax. Che
ck the manual that corresponds to your MySQL server version for the right syntax
to use near 'desc, mediaitem0_.label as label from media mediaitem0_' at lin"
2953 [http8080-Processor1] ERROR util.JDBCExceptionReporter - Could not execute
query
java.sql.SQLException: Syntax error or access violation message from server: "Yo
u have an error in your SQL syntax. Check the manual that corresponds to your M
ySQL server version for the right syntax to use near 'desc, mediaitem0_.label as
label from media mediaitem0_' at lin"
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2746)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1532)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1622)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2278)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2204)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 22, 2004 4:52 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
desc is a keyword I suppose - rename the column.


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.