-->
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: Querying on Composite key
PostPosted: Wed Oct 25, 2006 7:20 am 
Newbie

Joined: Mon Dec 05, 2005 4:17 am
Posts: 3
Hi,
I have a composite key mapping with a table's primary key. I want to write query either query.hbm or use criteria and select records with restriction(filter criteria) on one of the primary key column.
Suppose A table has APk as primary key having x and y columns then i am writing as below

[code]
Criteria criteria = session.createCriteria(A)
criteria.add(Restrictions.eq("comp_key.x",new Integer(1)));
criteria.list();
[/code]

I get
invalid user.table.column, table.column, or column specification
and the query generated will not have where clause.
here comp_key is the name of the PK in the hbm file and also the bean property inside A. x is of type int.

regards,
Karthik


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.