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
Register / Login


JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply 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
Ranch Hand

Joined: Jul 11, 2001
Posts: 15230

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?
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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Hibernate: Problem getting a simple list
 
Similar Threads
Deleting Record in a Web Application.
Who can solve that?
Hibernate: Column not found. org.hibernate.exception.GenericJDBCException
Unknown entity class: java.lang.Integer
Invalid Mapping Exception while inserting data through hibernate