-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: sharing properties among mapping files
PostPosted: Fri Apr 30, 2010 11:38 pm 
Newbie

Joined: Fri Apr 30, 2010 10:52 pm
Posts: 1
I have a number of database tables that are very similar and I was wondering if there is a way to store the common part of the mapping file in a file that can be included in the other mapping files.

An example of what I want to do follows:

Current two files:

file1.hbm.xml

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated 2009.12.04 MDG -->
<hibernate-mapping>
<class name="com.db.model.Tablea" table="Tablea">
<id name="tableaId" type="java.lang.Long">
<column name="PK_TABLEA" precision="22" scale="0" />
<generator class="sequence">
<param name="sequence">SEQ_TABLEA</param>
</generator>
</id>
<property name="col1" type="string">
<column name="COL1" length="20" not-null="true" />
</property>
<property name="col2" type="string">
<column name="COL2" length="50" />
</property>
<property name="coln" type="string">
<column name="COLN" length="50" />
</property>
</class>
</hibernate-mapping>


file2.hbm.xml

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated 2009.12.04 MDG -->
<hibernate-mapping>
<class name="com.db.model.Tableb" table="TABLEB">
<id name="tablebId" type="java.lang.Long">
<column name="PK_TABLEB" precision="22" scale="0" />
<generator class="sequence">
<param name="sequence">SEQ_TABLEB</param>
</generator>
</id>
<property name="col1" type="string">
<column name="COL1" length="20" not-null="true" />
</property>
<property name="col2" type="string">
<column name="COL2" length="50" />
</property>
<property name="coln" type="string">
<column name="COLN" length="50" />
</property>
</class>
</hibernate-mapping>

What I would like to do is:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated 2009.12.04 MDG -->
<hibernate-mapping>
<class name="com.db.model.Tableb" table="TABLEB">
<id name="tablebId" type="java.lang.Long">
<column name="PK_TABLEB" precision="22" scale="0" />
<generator class="sequence">
<param name="sequence">SEQ_TABLEB</param>
</generator>
</id>
INCLUDE A FILE CONTAINING THE COMMON PROPERTIES
</class>
</hibernate-mapping>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.