Link to home
Start Free TrialLog in
Avatar of Zolf
ZolfFlag for United Arab Emirates

asked on

Java Hibernate question

Hello there,

Can somebody explain to me this relationship mapping between entities.

for e.g.

I have a Driver class and a Vehicle class

now when I have the <many-to-one> element in the driver.hbm.xml file

this driver is the many or the vehicle is the many.

cheers
zolf
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

A real-life modelling would be M2M. One person often drives different vehicles. From the POV of the vehicle, it would often have more than one driver.
ASKER CERTIFIED SOLUTION
Avatar of Sharon Seth
Sharon Seth
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Cardinality is often clarified by thinking of the use cases of your data model. Let's take a real life example of modelling for a car pool with the following two common use cases:

a. Find all vehicles that Mr. Anthony Brown has driven from the car pool
b. Find all drivers of vehicle with licence plate FOOZ12

That would be done via M2M
Avatar of Zolf

ASKER

thanks everybody for the feedbacks!!

by: sharonseth

this is exactly what I am looking for. can you please tell me or refer me to some good online tutorial on hibernate with xml configuration. I have read many articles but no where it explained like to mentioned.

can you please giv em more e.g to clear my doubt.

so if I have a hbm file Manager and Project

and I have a Many-to-One in the Project hbm file

then  I will read it as Many Project are assigned to One Manager
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Zolf

ASKER

thanks vey much