views:

102

answers:

4

Is hibernate mapping necessary a lot? Which mapping is important for project? one-to-one, many-to-one, many-to-many??

+1  A: 

Which mapping you use depends on the relationships between the various pieces of data in your database. It's all about what you are trying to model; there is no "right" answer.

If you have a specific database design/mapping question, please ask.


A Hibernate mapping is a way to associate objects (like a Java object) with a relation in a database.

It sounds like you need to educate yourself by reading some documentation and coming back with specific questions. Do you have a working knowledge of Java and SQL? I would recommend starting out going over (at the very least) the introduction to Hibernate if you haven't already. If you have, then go a bit deeper - the full documentation index here. In particular, I think the chapter on Basic O/R Mapping is a must-read.

Also think about what specific problem you are trying to implement a solution to. You're only going to get vague answers to vague questions.

Matt Ball
A: 

This is a very vague question. The first thing you should be doing to determine this is find out exactly what data you will be storing in your database. From there you should be able to determine what the relationships between your data is.

For instance if you are dealing with students and the classes they take then you probably need a Many To Many relationship because many students can be enrolled in many classes.

Before you ask a question like this you need to plan a little bit first...

Peter D
A: 

well, yes, mapping it's necessary if you are using hibernate

but you can use

FLUENT HIBERNATE

which will do the mapping stuff for you, like automatically, you don't need to write a bunch of xml, just google it

Omu
A: 

I want to learn what is hibernate mapping? where should we use which mapping ? thanks for answers

stical
Please don't post responses as "answers" to your question - add them as comments or edits to your original post.
Matt Ball