aspose file tools*
The moose likes Object Relational Mapping and the fly likes Hibernate: Problem getting a simple list Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate: Problem getting a simple list" Watch "Hibernate: Problem getting a simple list" New topic
Author

Hibernate: Problem getting a simple list

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15292
    
    6

I am trying to get a simple list of departments from an employee table in my database using Hibernate. Appearntly this simple task is fairly difficult since Hibernate is all about populating objects with data. Anyway, here is the query I am using:



the createSQLQuery uses the Employee.class to determine the column, I think, so here is my Employee.hbm.xml



I am getting the following exception:



Any ideas?


GenRocket - Experts at Building Test Data
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Hibernate is claiming your ID column doesn't exist in the DB. Is it there?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
pascal betz
Ranch Hand

Joined: Jun 19, 2001
Posts: 547
hi Gregg

why do you use SQL ?

if i got it right, then you can use

the hibernate reference has a chapter on
HQL
in section 11.4 you can find some examples for the thing (i think) you want to do.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate: Problem getting a simple list
 
Similar Threads
Deleting Record in a Web Application.
Who can solve that?
Invalid Mapping Exception while inserting data through hibernate
Unknown entity class: java.lang.Integer
Hibernate: Column not found. org.hibernate.exception.GenericJDBCException