-->
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: timestamp and subclasses defined with discriminator
PostPosted: Mon Jul 09, 2007 11:50 am 
Newbie

Joined: Mon Jun 04, 2007 12:26 pm
Posts: 13
Location: Houston, Texas
Can generated timestamp fields be used with subclasses defined with a discriminator column?

It works great for for inserting any classes, and child classes that are not subclasses. However when I use it to insert a child record it get an error because the last_update_date can not be set to null.

Here's part of my xml definition for the subclass:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Pa.Domain" namespace="Pa.Domain">
  <class name="Pa.Domain.Settle" table="Settle" discriminator-value="0" >
    <id name="Id" column="UNIQUE_ID" type="int" >
      <generator class="assigned"/>
    </id>   
    <discriminator
      formula="(select n.subclass_name from numeric_code n where n.unique_id = TYPE_ID)"
     type="String"
    />
    <timestamp name="LastUpdateDate" column="LAST_UPDATE_DATE" generated="always" unsaved-value="null"/>
    <property column="CREATION_DATE" type="DateTime" name="CreationDate" generated="insert" />   
...
  <subclass name="SettleBatch"
              discriminator-value="PTBSettle">
...


The above is a child class defined in the parent as:
Code:
...
   <bag name="SettleList" inverse="true" lazy="true" cascade="all">
      <key column="P_ID" />
      <one-to-many class="Pa.Domain.Settle,Pa.Domain" />
    </bag>
...


Any suggestions? Thanks
DP


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.