• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate mapping files

 
Supri dharshni
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It depends on the choices you make in your mappings but potentially yes.
 
Supri dharshni
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic