-->
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 Restrictions.idEq(id)
PostPosted: Fri May 06, 2005 8:22 am 
Newbie

Joined: Fri May 06, 2005 8:11 am
Posts: 2
I am using such code to select objects by id

Code:
T findByID(Serializable id) throws HibernateException {
        T object = (T) HibernateUtils.getSession().createCriteria(clazz).add(Restrictions.idEq(id)).uniqueResult();
        return object;
    }



What is the right way to select in this way objects with composite id



Code:
<class name="Task" table="TASK" lazy="false">
        <composite-id>
            <key-many-to-one name="ClientSession" column="session_id"/>
            <key-many-to-one name="BookieSource" column="source_id"/>
        </composite-id>
    </class>


Thanks !


Top
 Profile  
 
 Post subject: I find solution
PostPosted: Fri May 06, 2005 8:27 am 
Newbie

Joined: Fri May 06, 2005 8:11 am
Posts: 2
I find solution in hibernate/test/cid

--
Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 22, 2007 10:50 am 
Beginner
Beginner

Joined: Thu Oct 12, 2006 6:19 pm
Posts: 34
Location: Guatemala
Hi Dmitriy, could you explain us what solution you are referring?

the hibernate/test/cid sample doesn't show how to retrieve composite id object using Restrictions.idEq()

Thanks in advance

_________________
God is Love


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.