-->
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.  [ 3 posts ] 
Author Message
 Post subject: sql statement stripped of tables
PostPosted: Fri Jun 26, 2009 5:09 am 
Beginner
Beginner

Joined: Wed Aug 09, 2006 12:09 pm
Posts: 20
Location: Belgium
Hibernate version 2.1.
Oracle 10

Hello I am using hibernate version 2.1 (only used 3 before but client is now forcing 2).

Whenever I make a simple query I get an ORA-00936: missing expression.

The reason for this, I think, is this. When I look in the logs with debug I see this:
Code:
2009-06-26 11:11:00,914 DEBUG [WebContainer : 2] impl.SessionImpl  (SessionImpl.java:1537)     - find: select from NRS_EVENT
2009-06-26 11:11:00,914 DEBUG [WebContainer : 2] impl.SessionImpl  (SessionImpl.java:1537)     - find: select from NRS_EVENT
2009-06-26 11:11:00,976 DEBUG [WebContainer : 2] hql.QueryTranslator (QueryTranslator.java:147)     - compiling query
2009-06-26 11:11:00,976 DEBUG [WebContainer : 2] hql.QueryTranslator (QueryTranslator.java:147)     - compiling query
2009-06-26 11:11:01,039 DEBUG [WebContainer : 2] impl.SessionImpl  (SessionImpl.java:2267)     - flushing session
2009-06-26 11:11:01,039 DEBUG [WebContainer : 2] impl.SessionImpl  (SessionImpl.java:2267)     - flushing session
2009-06-26 11:11:01,070 DEBUG [WebContainer : 2] impl.SessionImpl  (SessionImpl.java:2467)     - Flushing entities and processing referenced collections
2009-06-26 11:11:01,070 DEBUG [WebContainer : 2] impl.SessionImpl  (SessionImpl.java:2467)     - Flushing entities and processing referenced collections
2009-06-26 11:11:01,117 DEBUG [WebContainer : 2] impl.SessionImpl  (SessionImpl.java:2808)     - Processing unreferenced collections
2009-06-26 11:11:01,117 DEBUG [WebContainer : 2] impl.SessionImpl  (SessionImpl.java:2808)     - Processing unreferenced collections
2009-06-26 11:11:01,148 DEBUG [WebContainer : 2] impl.SessionImpl  (SessionImpl.java:2822)     - Scheduling collection removes/(re)creates/updates
2009-06-26 11:11:01,148 DEBUG [WebContainer : 2] impl.SessionImpl  (SessionImpl.java:2822)     - Scheduling collection removes/(re)creates/updates
2009-06-26 11:11:01,179 DEBUG [WebContainer : 2] impl.SessionImpl  (SessionImpl.java:2291)     - Flushed: 0 insertions, 0 updates, 0 deletions to 0 objects
2009-06-26 11:11:01,179 DEBUG [WebContainer : 2] impl.SessionImpl  (SessionImpl.java:2291)     - Flushed: 0 insertions, 0 updates, 0 deletions to 0 objects
2009-06-26 11:11:01,226 DEBUG [WebContainer : 2] impl.SessionImpl  (SessionImpl.java:2296)     - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
2009-06-26 11:11:01,226 DEBUG [WebContainer : 2] impl.SessionImpl  (SessionImpl.java:2296)     - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
2009-06-26 11:11:01,257 DEBUG [WebContainer : 2] impl.SessionImpl  (SessionImpl.java:1828)     - Dont need to execute flush
2009-06-26 11:11:01,257 DEBUG [WebContainer : 2] impl.SessionImpl  (SessionImpl.java:1828)     - Dont need to execute flush
2009-06-26 11:11:01,304 DEBUG [WebContainer : 2] hql.QueryTranslator (QueryTranslator.java:207)     - HQL: select from NRS_EVENT
2009-06-26 11:11:01,304 DEBUG [WebContainer : 2] hql.QueryTranslator (QueryTranslator.java:207)     - HQL: select from NRS_EVENT
2009-06-26 11:11:01,335 DEBUG [WebContainer : 2] hql.QueryTranslator (QueryTranslator.java:208)     - SQL: select  from
2009-06-26 11:11:01,335 DEBUG [WebContainer : 2] hql.QueryTranslator (QueryTranslator.java:208)     - SQL: select  from
2009-06-26 11:11:01,382 DEBUG [WebContainer : 2] impl.BatcherImpl  (BatcherImpl.java:204)     - about to open: 0 open PreparedStatements, 0 open ResultSets
2009-06-26 11:11:01,382 DEBUG [WebContainer : 2] impl.BatcherImpl  (BatcherImpl.java:204)     - about to open: 0 open PreparedStatements, 0 open ResultSets
2009-06-26 11:11:01,414 DEBUG [WebContainer : 2] hibernate.SQL     (BatcherImpl.java:230)     - select  from
2009-06-26 11:11:01,414 DEBUG [WebContainer : 2] hibernate.SQL     (BatcherImpl.java:230)     - select  from
2009-06-26 11:11:01,460 DEBUG [WebContainer : 2] impl.BatcherImpl  (BatcherImpl.java:253)     - preparing statement
2009-06-26 11:11:01,460 DEBUG [WebContainer : 2] impl.BatcherImpl  (BatcherImpl.java:253)     - preparing statement


The main lines I am worried about are these:
hql.QueryTranslator (QueryTranslator.java:207) - HQL: select from NRS_EVENT
hql.QueryTranslator (QueryTranslator.java:208) - SQL: select from


Note that the from and NRS_EVENT are stripped.

I have written the code in a number of ways like this:
Code:
List f = session.find("select from NRS_EVENT");


How I do it when using Hibernate3
Code:
retEvent = (Event) session.createQuery("from NRS_EVENT where SIGNING_ID = ?")
                                  .setString(0, uuid)
                                  .uniqueResult();


And both ways end up with the same error.

Any hints or tips? I have been using Hibernate 3 for a number of years and I have never seen this behavour.

Thanks for reading.
cheers
Martin


Top
 Profile  
 
 Post subject: Re: sql statement stripped of tables
PostPosted: Fri Jun 26, 2009 6:16 am 
Newbie

Joined: Tue Jun 23, 2009 3:31 am
Posts: 10
Code:
retEvent = (Event) session.createQuery("from NRS_EVENT where SIGNING_ID = ?")
                                  .setString(0, uuid)
                                  .uniqueResult();


Can u query with object rather than doing with table and object property rather than column?


Top
 Profile  
 
 Post subject: Re: sql statement stripped of tables
PostPosted: Fri Jun 26, 2009 9:37 am 
Beginner
Beginner

Joined: Wed Aug 09, 2006 12:09 pm
Posts: 20
Location: Belgium
Quote:
Can u query with object rather than doing with table and object property rather than column?


Oh yes of course can't see for looking. Yes when I change it to query with Object and table column it works. Thanks for the hint.

cheers


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