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
zolfAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CEHJCommented:
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.
0
Sharon SethCommented:
Many drivers can drive a vehicle .
One way to read without getting confused is , start reading the hbm file name and then the realtionship and then the entity to which we are specfying the relation

Driver
 |
 |
Many-to-One----- Vehicle
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CEHJCommented:
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
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

zolfAuthor Commented:
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
0
CEHJCommented:
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
You won't get much clearer than the following (for Project read Certificate, for Manager read Employee):
http://www.tutorialspoint.com/hibernate/hibernate_one_to_many_mapping.htm
0
Sharon SethCommented:
I guess you just have to keep on looking at sample hbms and keep thinking abt them . You won't find a one shot statement that will explain these.
0
zolfAuthor Commented:
thanks vey much
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.