jQuery in Action, 3rd edition
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
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate: Problem getting a simple list" Watch "Hibernate: Problem getting a simple list" New topic

Hibernate: Problem getting a simple list

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15302

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

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
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
It's not a secret anymore!