reset password
Author Message
Gayaneh
Posts: 40
Posted 10:49 Oct 28, 2012 |

When I have relations such between Project and Advisors, Resources,... how should we construct those objects when we query from database?

For example for fetching one project we  query projects table. I was thinking that it should construct the lists of Advisors, Resources, etc. using the relations between those table automatically... :)  But i think I am wrong and I have to build those lists by by  querying their corresponding tables... Is this is the right way to go?

With thanks in  advance.

Gayaneh

cysun
Posts: 2935
Posted 11:13 Oct 28, 2012 |

You just need to query for Project. When you access something referenced by an object, e.g. project.getAdvisors(), they will be loaded automatically from the database by Hibernate.

Last edited by cysun at 11:14 Oct 28, 2012.