-->
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: composite-id and IQuery.SetEntity
PostPosted: Tue Apr 11, 2006 12:11 pm 
Newbie

Joined: Mon Dec 12, 2005 1:54 pm
Posts: 5
Hi,

I get a QueryException "path expression ends in a composite value" when trying :

Code:
// Parent  parent is already instancied

string hql = "From Child child Where child.Parent=:parent";
IQuery q = Session.CreateQuery(hql);
q.SetEntity("parent", parent);
IList llist = qq.List();


My Parent.hbm.xls contains ...
Code:
<composite-id name="Id" class="Domaine.ParentId, Domaine">
   <key-property name="Name" type="String">
      <column name="Name" sql-type="varchar" not-null="true" />
   </key-property>
         
   <key-property name="LastName" type="String" >
      <column name="LastName" sql-type="String" not-null="true" />
   </key-property>
</composite-id>


My Child.hbm.xls contains ...
Code:
<many-to-one name="Parent" class="Domaine.Parent, Domaine" >
   <column name="Name" sql-type="varchar" not-null="true"/>
   <column name="LastName" sql-type="varchar" not-null="true"/>
</many-to-one>



My ParentId class...
Code:


public class ParentId
{

   private string _name;
   private string _surName;

   public virtual string Name
   {
      get { return _name; }
      set { _name = value; }
   }

   public virtual string SurName
   {
      get { return _surName; }
      set { _surNAme = value; }
   }



   public override bool Equals(object obj)
   {
      ParentId otherObj = obj as ParentId ;
      if (otherObj == null)
      {
         return false;
      }

      if (otherObj.Name.Equals(this.Name)
            &&
         otherObj.SurName.Equals(this.SurName))
         {
            return true;
         }
         else
         {
            return false;
         }

   }

   public override int GetHashCode()
   {
      return Name.GetHashCode() ^ SurName.GetHashCode();
   }

}


Thank's


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 12, 2006 9:44 am 
Newbie

Joined: Mon Dec 12, 2005 1:54 pm
Posts: 5
I've found an issue fixed in Hibernate 3.0 final on this subject.


Top
 Profile  
 
 Post subject: Had the same problem... any news?
PostPosted: Thu Apr 13, 2006 9:31 pm 
Regular
Regular

Joined: Fri Jul 29, 2005 9:46 am
Posts: 101
I have had the same problem... any news?


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.