-->
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: Components / Composite-Id + InExpression
PostPosted: Fri Oct 14, 2005 4:52 am 
Newbie

Joined: Wed Mar 16, 2005 5:06 am
Posts: 4
Hi,
It seems that the InExpression does not properly work with Component or Composite-Id 's

I have following hbm.xml :
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
      "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
          "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
   <class name="be.kuleuven.toledo.model.bean.User" table="TLUSER">
      <composite-id name="sourcedId" class="be.kuleuven.toledo.model.bean.SourcedId">
           <key-property name="source" column="DATASOURCE" />
           <key-property name="id" column="SOURCEID" />
       </composite-id>
      <timestamp name="modifiedDate" column="MODDATE"/>
      <property name="userId" column="USERID" type="long" access="field"/>
      <property name="inet" column="INET" type="string"/>
      <property name="firstName" column="VNAAM" type="string"/>
      <property name="familyName" column="FNAAM" type="string"/>
      <property name="emailAddress" column="EMAIL" type="string"/>
      <property name="creationDate" column="CRDATE" type="timestamp"/>
   </class>
</hibernate-mapping>


And when executing this
Code:
// build a list of of objects of composed-id
String[] ids = {"u0040926","u0040925"};
List list = new ArrayList();
for (int i = 0; i < ids.length; i++) {
   SourcedId sourcedId =  new SourcedId();
   sourcedId.setId(ids[i]);
   sourcedId.setSource("KULEUVEN");
   list.add(sourcedId);
}

// find all objects with composed-id in list
session.createCriteria(User.class).add(
   Expression.in("sourcedId", list)).list();



it returns no results when my list is larger than 1 element, though, if I set hibernate.show_sql=true and execute the query manually, everything's right.... InExpression only works for simple properties, am I right?


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.