Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate generating wrong query

 
Pranjal Swarup
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am getting the following exception

org.hibernate.exception.SQLGrammarException: could not load an entity: [com.dao.Account#121]

Sql ssyntax generated is:

Hibernate:
select
account0_.employeeId as employeeId0_0_,
account0_.id as id0_0_,
account0_.firstname as firstname0_0_,
account0_.lastname as lastname0_0_,
account0_.type as type0_0_,
account0_.managerId as managerId0_0_
from
laps.user.account account0_
where
account0_.employeeId=?

problem is it appends a user between laps.account, user is another table that I excluded while generating DAOs, any idea?

thanks,
pranjal
 
Hebert Coelho
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, Pranjal Swarup

Welcome to javaranch.

How are you doing your search in the database?
 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
user is another table that I excluded while generating DAOs, any idea?

How you do this? And what mappings you have for this? You may need to tell more details (TellTheDetails).
 
Pranjal Swarup
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks the problem has been resolved, it was mainly an error because I had set both database name and initial catalog field.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic