File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes need help with hibernate query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "need help with hibernate query" Watch "need help with hibernate query" New topic

need help with hibernate query

Naresh Chaurasia
Ranch Hand

Joined: May 18, 2005
Posts: 356
I have following entities.

i.e. there is many(Guitar) to one(GuitarSpec) relation. I am fetching a row from GuitarSpec(these rows are unique). Now i want to fetch rows from Guitar(Column specification_id references the specId from GuitarSpec).

I am trying the following but it does not work.

I am able to fetch GuitarSpec , but not able to fetch Guitar. How can i fetch Guitar.


SCJP 1.4, SCWCD1.4, OCA(1Z0-007)
Naresh Chaurasia
Ranch Hand

Joined: May 18, 2005
Posts: 356
I was able to solve the problem using following query:

I agree. Here's the link:
subject: need help with hibernate query
Similar Threads
Disagreement with Encapsulation example of Head First OOAD
Lazy loading not working as expected
Getting HibernateException: Errors in named queries
Getting same record in query.
ORA-00001: unique constraint exception