This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes how many entities? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "how many entities?" Watch "how many entities?" New topic
Author

how many entities?

Guy Emerson
Greenhorn

Joined: Dec 14, 2010
Posts: 27
Hi brethren,
This is my introductory post here.
Could you explain how do we decide on the number of hibernate mapping files .In real-time projects do we create one .hbm.xml file or many? If we have 25 entities, do we write the mapping for all 25 classes in the same .hbm.xml file or we go for individual mapping files for each class. What is prevalent practice in the real time?

And what about the configuration file .cfg.xml. As far as I know we don't need more than one configuration file. do we?

Thanks all java enthusiasts .
Arun Kumarr
Ranch Hand

Joined: May 16, 2005
Posts: 513

Guy Emerson wrote:
If we have 25 entities, do we write the mapping for all 25 classes in the same .hbm.xml file or we go for individual mapping files for each class. What is prevalent practice in the real time?

Hi Guy Emerson, Welcome to Javaranch. The prevalent practice is to have 25 hbm files packaged in logical folders.

Guy Emerson wrote:
And what about the configuration file .cfg.xml. As far as I know we don't need more than one configuration file. do we?

We don't need. You can have one .cfg.xml file, unless you are dealing with two separate databases/schemas in your application.

If you are not laughing at yourself, then you just didn't get the joke.
Guy Emerson
Greenhorn

Joined: Dec 14, 2010
Posts: 27
Right Kumarr,
Thanks for the reply. what I was expecting has been confirmed by you. It really bothers one if he knows the answer but not sure about it. So it is great to hear from the people who are experienced like you.
Thanks again
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how many entities?
 
Similar Threads
Working Example Needed..
hbm.xml file generation in netbeans
How to map .hbm.xml file in persistence.xml
No more .hbm.xml files
could not read mapping from resource