This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
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

Can we have more than one class mappings in one hibernate mapping file?

 
Tapan Maru
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Can we have more than one class mappings in one hibernate mapping file?

lets say my module has 5 tables so can I logically group 5 class in one hibernate mapping file like the following?

<hibernate-mapping package="org.mypackage">

<class name="Class1" table="Table1">
---- column mappings goes here
</class>
<class name="Class2" table="Table2">
---- column mappings goes here
</class>
<class name="Class3" table="Table3">
---- column mappings goes here
</class>
<class name="Class4" table="Table4">
---- column mappings goes here
</class>
<class name="Class5" table="Table5">
---- column mappings goes here
</class>

</hibernate-mapping>



if we can declare like this, what is the advantage of such scenario?

Thanks

Tapan Maru
tapanmaru@gmail.com
 
Tim McGuire
Ranch Hand
Posts: 820
IntelliJ IDE Tomcat Server VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sure.
Check out http://docs.jboss.org/hibernate/core/3.3/reference/en/html/mapping.html#mapping-declaration-mapping

benefits are pretty obvious. Fewer files to manage. You can group mappings by package.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic