Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate mapping - naming convention

 
Patricia Samuel
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am suspicious about few point in hibernate -

1) What should be the name of mapping file . It should be same as of class mentioned.


For example here class name is Event then mapping file name should be Event.hbm.xml. Is it mandatory.

2) We have two option to manage mapping files - 1) It could be file per class 2) multiple classes in one file.

In the case of multiple classes is there any naming must that we need to follow or in a simple language what would be the name of file in case of multiple classes in one file.

Thanks in advance !!!

Regards,
Patricia Samuel.
 
Victor Dolirio
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm suposing that you are asking rather than stating (despite you don't write it this way ;) ).

1st) The name of configuration file can be what you wanna it be. Once you'll declare it in the configuration model (i.e. hibernate.cfg.xml). But it's a convension to use NameOfBean.hbm.xml.

2nd) You can have as many configurations as you need to a single Bean. Despite I never had seen a true need for this in real (large) projects. Just be careful to duplicate Entities in you configuration model.

I hope be useful.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic