Forums Register Login

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

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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.

I am going down to the lab. Do NOT let anyone in. Not even this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 4488 times.
Similar Threads
Enforcing Forign Key constraints via Hibernate
[Hibernate] Composite key one-to-many XML Error
Problem of Unknown Entity
Looking for a database to Java code generator
Hibernate 3.1
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 05:30:36.