-->
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.  [ 6 posts ] 
Author Message
 Post subject: ERROR: Bag with composite-element and 'parent' element
PostPosted: Fri Mar 23, 2007 1:30 pm 
Beginner
Beginner

Joined: Fri Oct 20, 2006 8:02 am
Posts: 36
.
If I use the field in the attribute 'name' of the 'parent' elemente of de 'composite-element' into the 'bag' many-to-may if throws an exception saying that the property wasn't found.

NHibernate.PropertyNotFoundException:
{"Could not find a setter for property 'objClass1' in class 'Class1'"}
{"Could not find a setter for property 'objClass2' in class 'Class2'"}

It should try to set the field and is trying to set the property!!!

Hibernate version: 1.2RC1

Mapping documents:
Class1 mapping:
Code:
<?xml version='1.0' encoding='utf-8' ?>
<hibernate-mapping xmlns='urn:nhibernate-mapping-2.2' default-access='field' >
   <class name='Class1' table='class1' lazy='false'>
      <id name='pkClass1' column='pkClass1' type='String' length='15' >
         <generator class='assigned'/>
      </id>
      <property name='name1' column='name1' type='String' />
      <bag name='relation' cascade='all' lazy='true' inverse='true' table='tbl_relation' >
         <key column='pkClass1' />
         <composite-element class='ClassRelation' >
            <parent name='objClass1' />
            <many-to-one name='objClass2' column='pkClass2' class='Class2' not-null='true' />
            <property name='date' column='date' type='DateTime' not-null='true' />
         </composite-element>
      </bag>
   </class>
</hibernate-mapping>


Class2 mapping:
Code:
<?xml version='1.0' encoding='utf-8'?>
<hibernate-mapping xmlns='urn:nhibernate-mapping-2.2' default-access='field' >
   <class name='Class2' table='class2'  lazy='false'>
      <id name='pkClass2' column='pkClass2' type='Int32' unsaved-value='0' >
         <generator class='native' >
            <param name='sequence'>seq_class2_pk</param>
         </generator>
      </id>
      <property name='name2' column='name2' type='String' />
      <bag name='relation' cascade='all' lazy='true' table='tbl_relation' >
         <key column='pkClass2' />
         <composite-element class='ClassRelation' >
            <parent name='objClass2' />
            <many-to-one name='objClass1' column='pkClass1' class='Class1' not-null='true' />
            <property name='date' column='date' type='DateTime' not-null='true' />
         </composite-element>
      </bag>
   </class>
</hibernate-mapping>


Relation class 'ClassRelation' mapping:
Code:
<?xml version='1.0' encoding='utf-8' ?>
<hibernate-mapping xmlns='urn:nhibernate-mapping-2.2' default-access='field' >
   <class name='ClassRelation' table='tbl_relation' lazy='false'>
      <composite-id>
         <key-many-to-one name='objClass1' column='pkClass1' class='Class1' />
         <key-many-to-one name='objClass2' column='pkClass2' class='Class2' />
      </composite-id>
      <property name='date' column='date' type='DateTime' not-null='true' />
   </class>
</hibernate-mapping>


Name and version of the database you are using: Firebird 1.5


Top
 Profile  
 
 Post subject: ERROR: Bag with composite-element and 'parent' element
PostPosted: Mon Mar 26, 2007 3:13 pm 
Beginner
Beginner

Joined: Fri Oct 20, 2006 8:02 am
Posts: 36
Hi people;

Hi Sergey, should I add this to JIRA?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 26, 2007 3:25 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
No. Specify the appropriate access strategy for the parent element (access="field" for example).


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 26, 2007 4:30 pm 
Beginner
Beginner

Joined: Fri Oct 20, 2006 8:02 am
Posts: 36
It is just done in the top of the file, setting the default-access:

Code:
<hibernate-mapping xmlns='urn:nhibernate-mapping-2.2' default-access='field' >


And there is only the 'name' attribute in the 'parent' element.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 27, 2007 12:56 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Eheh, overlooked that one. In that case, please report it.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 27, 2007 10:04 am 
Beginner
Beginner

Joined: Fri Oct 20, 2006 8:02 am
Posts: 36
reported: NH-957


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