posted 16 years ago
hi all, i am newbei to Hibernate, i am working on a project, it has two masters one is Being and another one is Debit. in Being master i am storing just beingName, in Debit master i am storing debitName and all the associated beingIds.
i am using three tables to store the content:
being:
beingId long primary key, auto generated
beingName varchar(100)
debit:
debitId long primary key, auto generated
debitName varchar(100)
debit_being:
debitId long forieg key
beingId long forieg key
to persist being details i am using Being.hbm.xml
while user adding a being he will just enter beingName and submits, that will store in being table through Being.hbm.xml file
to persist debit details i am using debit.hbm.xml
while user adding a debit he will enter debitName and select multiple beingNames from the selection list and submits, now the debitName is storing to debit table, then newly generated debitId and associated beingIds are storing in debit_being table.
now when i am listing the debits i need to display debits with associated beingNames rather beingIds so, is it possible to define in the mapping document (i,e Debit.hbm.xml) so that i can retrieve all the associated Being objects of perticular Debit object.
or
do i have to write hql query to join the tables.
any help appriciated.
thanks in advance...