Dustin Sun
Dustin Sun

Reputation: 5532

Java hibernate how to use select ... where id in ()

I have Account class--account table mapping already.

Now I need use

from account where account_id in (select account_id from anothertable where...)

I got an error saying

org.hibernate.hql.ast.QuerySyntaxException: account is not mapped [from account where account_id in (select account_id from anothertable where...)]

Any suggestions?

Upvotes: 1

Views: 661

Answers (1)

Dustin Sun
Dustin Sun

Reputation: 5532

I should use CLASS NAME, not TABLE NAME. Thank you for your time anyway.

Upvotes: 1

Related Questions