-->
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.  [ 2 posts ] 
Author Message
 Post subject: Archive values of class and joined-subclass when updating
PostPosted: Tue Nov 01, 2005 1:23 pm 
Newbie

Joined: Tue Nov 01, 2005 1:06 pm
Posts: 1
Hibernate version: 2.1

Mapping documents:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" schema="dbo">
<class name="EI.Poco.PoParty, EI.Poco" table="Party">
<id name="Id" type="Int32" column="partyId">
<generator class="identity" />
</id>
<version name="Version" column="version" access="nosetter.camelcase"/>
<property name="DateFrom" column="dateFrom" type="Nullables.NHibernate.NullableDateTimeType, Nullables.NHibernate" />
<property name="DateTo" column="dateTo" type="Nullables.NHibernate.NullableDateTimeType, Nullables.NHibernate" />
<property name="IntroducerId" column="introducerId" type="Nullables.NHibernate.NullableInt32Type, Nullables.NHibernate" />
<bag name="PartyArchives" inverse="true">
<key column="partyId" />
<one-to-many class="EI.Poco.PoPartyArchive, EI.Poco" />
</bag>
<property name="PartyTypeId" column="partyTypeId" type="Byte" />
<property name="UpdatedByUsrId" column="updatedByUsrId" type="Int32" />
<property name="UpdatedDateTime" column="updatedDateTime" type="Nullables.NHibernate.NullableDateTimeType, Nullables.NHibernate" update="false" insert="false" access="nosetter.camelcase"/>
<joined-subclass name="EI.Poco.PoOrganisation, EI.Poco" table="Organisation">
<key column="partyId"/>
<property name="Established" column="established" type="Nullables.NHibernate.NullableDateTimeType, Nullables.NHibernate"/>
<property name="OrgName" column="orgName" type="String" />
</joined-subclass>
<joined-subclass name="EI.Poco.PoPerson, EI.Poco" table="Person">
<key column="partyId"/>
<property name="AbiGenderId" column="abiGenderId" type="Nullables.NHibernate.NullableInt32Type, Nullables.NHibernate" />
<property name="DateOfBirth" column="dateOfBirth" type="Nullables.NHibernate.NullableDateTimeType, Nullables.NHibernate" />
<property name="AbiTitleId" column="abiTitleId" type="Nullables.NHibernate.NullableInt32Type, Nullables.NHibernate" />
<property name="Firstnames" column="firstnames" type="String" />
<property name="Initials" column="initials" type="String" />
<property name="Lastname" column="lastname" type="String" />
</joined-subclass>
</class>
</hibernate-mapping>

----------------------

Tables:

-Party
-PartyArchive

-Person
-PersonArchive

Question:

When any update is performed I would like to save the previous values to the archive tables.

I can achieve this using triggers, however the triggers cannot manage the foreign key relationship between the PartyArchive table and the PersonArchive table [PartyArchive.partyArchiveId=PersonArchive.partyArchiveId].

Can I customise the Hibernate Update to include an archive process?

Does anyone have any suggestions?


Regards


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 01, 2005 1:48 pm 
Beginner
Beginner

Joined: Thu Jan 22, 2004 8:22 pm
Posts: 48
The following Wiki entry might get you started.

http://www.hibernate.org/318.html


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.