-->
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: parametrized query with composite PK
PostPosted: Wed Sep 30, 2009 9:45 am 
Newbie

Joined: Wed Sep 30, 2009 9:32 am
Posts: 1
Hello,

I'm using Java Persistence and Jboss.

I have an entity with a composite primary key (pk.root, pk.extension) and when I try to query for multiple istances of the pk I get a "java.sql.sqlexception: No value specified for parameter 4" error.

The EJBQL query has the following where clause:
WHERE Entity.pk = ?1 or Entity.pk = ?2

Then I set the two parameters (entitypk1 and entitypk2 are two istance of the primary key composite object):
query.setParameter(1, entitypk1);
query.setParameter(1, entitypk2);

This produces an Hibernate query as follows:
where (ENTITY_PK_ROOT, ENTITY_PK_EXT) = (?, ?) OR (ENTITY_PK_ROOT, ENTITY_PK_EXT) = (?, ?)

which, as said, produces a:
java.sql.sqlexception: No value specified for parameter 4

Any idea?

Thanks, Umberto


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.