readthefuckingmanual.net

[SOLVED] org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [FROM User]

Error added: 2007-10-27T18:33:22Z

2 people waiting for the answer...

5 answers found.

Answer 738 (63.636364% helpful)

whenever u map nay database table into java class file u need 2 use name of d class as table name and variables of the class as table fields 
e.g. 
database table is bank with field bank_id
java class file is Bank with variable bank_id 
den ur query stmt should be 

Query q = session.createQuery(\"from Bank as bank where bank.bankID = \'10101\'\");
Permalink

Answer 1228 (80.0% helpful)

3
Permalink

Answer 666 (55.555553% helpful)

org.hibernate.hql.ast.QuerySyntaxException: TBEE is not mapped
Permalink

Answer 430 (37.5% helpful)

In hibernate.cfg.xml:

<mapping resource=\"package/User.hbm.xml\"/>
Permalink

Answer 945 (33.333332% helpful)

Check the imports of your \'@Entity\' annotations in your beans

If it is:

    org.hibernate.annotations.Entity;

Then change it to:

    import javax.persistence.Entity;

and life will be sweet. 
http://billcomer.blogspot.com/2008/04/hibernate3-hibernatequeryexception.html
Permalink

Add an answer/solution

If you know the answer, please add your own solution below.
If you don't know, but find out later, please come back and share your answer - there will be other people struggling with this too.


Please enter 61948 here

If you want to be notified via email when this is solved, enter your email address here: