• Post Reply Bookmark Topic Watch Topic
  • New Topic

Hibernate: not getting the associated List retrieved  RSS feed

Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

An entity X has a list of entity Y and the entity Y has an instance of entity Z.

The relation between X to Y is OneToMany and the relation between Y to Z is ManyToOne.

I want to retrieve X and have all the associated entities retrieved with them as well.

What HQL query do I write so that I get the whole chain retrieved all at once.
or What annonations do I use for it? At present its hibernateTemplate.find("from X").

X=ServiceProvider, Y=BusinessLocations.java, Z=State.java

I have the entities annotated below and I am having the whole chain persisted into database but when i try to retrieve the list of Y(BusinessLocation), I get nothing.

What do I do join X with Y and Y with Z?

Below are the entities x, Y and Z.




Could someone help me out here?

Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!