-->
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.  [ 3 posts ] 
Author Message
 Post subject: Abstracting common mapping property
PostPosted: Fri Oct 06, 2006 5:10 pm 
Newbie

Joined: Tue Dec 13, 2005 6:47 pm
Posts: 7
I have this four column in every table, so to map this column I created a rowhistory component and declared in every hibernate mapping

I was looking if some how the rowhistory component mapping can be abstracted to one file and extended or imported in every hibernate mapping file.

So I don't have declare rowhistory component and it's property in every mapping file

<component name="rowHistory" class="com.liquid.ingest.RowHistory">
<property name="createdBy" column="CREATED_BY" not-null="true" type="java.lang.String" />
<property name="createdDate" column="CREATED_DATE" not-null="true" type="java.sql.Timestamp" />
<property name="modifiedBy" column="MODIFIED_BY" not-null="true" type="java.lang.String" />
<property name="modifiedDate" column="MODIFIED_DATE" not-null="true" type="java.sql.Timestamp" />
</component>


Thanks
Gopal


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 06, 2006 5:46 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
its part of xml and called entity includes

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 07, 2006 4:46 pm 
Newbie

Joined: Tue Dec 13, 2005 6:47 pm
Posts: 7
It works but after I have used Hibernate 3.2.cr4, I tried with version 3.1.3 but always get xml parsing error

Mapping xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" [
<!ENTITY AbstractDomainObject SYSTEM "classpath://com/liquid/ingest/domain/AbstractDomainObject.xml">
]>

<hibernate-mapping package="com.liquid.ingest.domain.company">
<class name="Company" table="INV_COMPANY" lazy="false">

<!-- Include superclass properties -->
&AbstractDomainObject;

</class>
</hibernate-mapping>


AbstractDomainObject.xml

<component name="rowHistory" class="com.liquid.ingest.RowHistory">
<property name="modifiedBy" column="MODIFIED_BY" type="java.lang.String" />
<property name="modifiedDate" column="MODIFIED_DATE" type="java.sql.Timestamp" />
</component>

Thanks for help


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

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.