GeeCON Prague 2014*
The moose likes Object Relational Mapping and the fly likes Hibernate mapping files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate mapping files" Watch "Hibernate mapping files" New topic
Author

Hibernate mapping files

Supri dharshni
Greenhorn

Joined: Jul 14, 2009
Posts: 25
Hi ,

This is regarding hbm file creation in hibernate. In my database i am having 100 tables and i will be using all these tables for my querying.In such case do i need to create 100 hbm and pojo classes? or is there some other way to handle without creating hbm files for all the tables and only for few.Please clarify.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

It depends on the choices you make in your mappings but potentially yes.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Supri dharshni
Greenhorn

Joined: Jul 14, 2009
Posts: 25
Hi Paul ,

depends on the choices you make in your mappings - you mean my entity mappings(one to many,many to one etc..). In such a case also i have to create the hbm and pojo classes for all ,right ? So i think there is no way to reduce the number the hbm and pojo classes. Please correct me if i am wrong.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

It depends which entities you choose to map (does you application need access to all of them right form the start?) and how you map them (i.e. table per class hierarchy etc.)

Hiberate has a range of generation tools you can use - the the website for details.
sarmaP lolla
Greenhorn

Joined: Feb 01, 2009
Posts: 18
Yes. you need to.

We used NetBeans.

NetBeans has reverse engineering technique you can use. It takes the database connection and creates the HBM files and domain objects for you. It takes care of the relationships and also the multi-primary key issues. You can also go for annotation approach. Why go XML way? It is more easy to have the annotations and the domain object in the same file.

Sarma
 
GeeCON Prague 2014
 
subject: Hibernate mapping files