-->
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.  [ 4 posts ] 
Author Message
 Post subject: "unexpected token: as "
PostPosted: Tue Oct 05, 2004 10:52 am 
Newbie

Joined: Tue Oct 05, 2004 10:42 am
Posts: 3
Hibernate version: 2.1

I didn't see anything about this in the FAQ. I tried to do a simple find following the examples in Section 9.3 of the Reference Document.

My code looks like the following:
List userList = hibSession.find("from User as u where u.name = ?",
name, Hibernate.STRING);

When my code executes, I get the following message;
unexpected token: as [from User as u where u.name = ?]

Any hints on what is going wrong? It seems like a very simple statement and I am trying to reproduce the example as closely as I can.

The example from Section 9.3 is:
List cats = sess.find(
"from Cat as cat where cat.birthdate = ?",
date,
Hibernate.DATE
);


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 05, 2004 11:21 am 
Newbie

Joined: Mon Jun 21, 2004 12:58 pm
Posts: 15
just try taking out "as" .
from User u .....


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 05, 2004 11:26 am 
Senior
Senior

Joined: Sun Jan 04, 2004 2:46 pm
Posts: 147
Usually means that the preceeding object name ( ie User ) has not been registered in the configuration/sessionfactory.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 05, 2004 11:32 am 
Newbie

Joined: Tue Oct 05, 2004 10:42 am
Posts: 3
Myk wrote:
Usually means that the preceeding object name ( ie User ) has not been registered in the configuration/sessionfactory.


Thanks. The problem was that I was using the name of the database table ("User"), instead of the name of the persistent class ("HIBUser").


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