-->
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: Component behaviour is different?
PostPosted: Mon Jun 13, 2005 9:13 pm 
Regular
Regular

Joined: Tue May 24, 2005 12:55 pm
Posts: 56
I think I'm finding that components have a different behaviour than the main mapped class. For example, the following produces a error during an Update/Save due to the PERS_ID column being repeated.

Code:
Client cl = new Client();
cl.VendorId = 2;
cl.Contacts.PersonId = 1;
sess.Save(cl);

<class name="Data.Client, Data" table="CL">
   <jcs-cache usage="read-write" />
   <id column="CL_ID" name="Id" unsaved-value="0" type="Int32">
      <generator class="native" />
   </id>
   <property column="VENDOR_ID" name="VendorId" type="Nullables.NHibernate.NullableInt32Type, Nullables.NHibernate" not-null="false" />
   <component class="Data.ClientPersons, Data" name="Contacts">
      <property column="PERS_ID" name="PersonId" type="Nullables.NHibernate.NullableInt32Type, Nullables.NHibernate" not-null="false" />
      <many-to-one column="PERS_ID" name="Person1" class="Data.Person, Data" cascade="none" outer-join="false" insert="false" update="false" not-null="false" />
   </component>
</class>


However, this Updates/Saves just fine:

Code:
Client cl = new Client();
cl.VendorId = 2;
cl.PersonId = 1;
sess.Save(cl);

<class name="Data.Client, Data" table="CL">
   <jcs-cache usage="read-write" />
   <id column="CL_ID" name="Id" unsaved-value="0" type="Int32">
      <generator class="native" />
   </id>
   <property column="VENDOR_ID" name="VendorId" type="Nullables.NHibernate.NullableInt32Type, Nullables.NHibernate" not-null="false" />
   <property column="PERS_ID" name="PersonId" type="Nullables.NHibernate.NullableInt32Type, Nullables.NHibernate" not-null="false" />
   <many-to-one column="PERS_ID" name="Person1" class="Data.Person, Data" cascade="none" outer-join="false" insert="false" update="false" not-null="false" />
</class>


Is this the expected behaviour or should I log this in JIRA as a bug?


Top
 Profile  
 
 Post subject: oops
PostPosted: Tue Jun 14, 2005 1:08 pm 
Regular
Regular

Joined: Tue May 24, 2005 12:55 pm
Posts: 56
I found this recent post with the same issue, different mapping, but I think the issue would only happen for him while he is using a component. (not sure why i didn't see it in my searches. :oops: )

http://nhibernate.sourceforge.net/forum/viewtopic.php?t=165&highlight=access


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.