Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » Composite Key and IN Operator
Composite Key and IN Operator [message #677422] Wed, 08 June 2011 09:14 Go to next message
Eclipse UserFriend
Hello,

I'm using the EclipseLink that comes bundled with NB 6.9 and MySQL 5.1.
Got an exception on trying to use IN operator with a composite PK.
Seems like you only support the equal operator.

newer versions already support this?

best regards
la00
Re: Composite Key and IN Operator [message #683401 is a reply to message #677422] Mon, 13 June 2011 13:06 Go to previous messageGo to next message
Eclipse UserFriend
What was the query you were trying to execute?

JPQL does not allow nested array with an IN.

EclipseLink does not currently support nested arrays with IN through JPQL, but does with EclipseLink Expressions. Please log an enhancement to have the support added to JPQL.

(no subject) [message #683408 is a reply to message #677422] Mon, 13 June 2011 13:06 Go to previous messageGo to next message
Eclipse UserFriend
What was the query you were trying to execute?

JPQL does not allow nested array with an IN.

EclipseLink does not currently support nested arrays with IN through JPQL, but does with EclipseLink Expressions. Please log an enhancement to have the support added to JPQL.


--
James : http://wiki.eclipse.org/EclipseLink : http://en.wikibooks.org/wiki/Java_Persistence : http://java-persistence-performance.blogspot.com/
(no subject) [message #683411 is a reply to message #677422] Mon, 13 June 2011 13:06 Go to previous messageGo to next message
Eclipse UserFriend
What was the query you were trying to execute?

JPQL does not allow nested array with an IN.

EclipseLink does not currently support nested arrays with IN through JPQL, but does with EclipseLink Expressions. Please log an enhancement to have the support added to JPQL.


--
James : http://wiki.eclipse.org/EclipseLink : http://en.wikibooks.org/wiki/Java_Persistence : http://java-persistence-performance.blogspot.com/
Re: Composite Key and IN Operator [message #683930 is a reply to message #677422] Tue, 14 June 2011 13:15 Go to previous messageGo to next message
Eclipse UserFriend
Hello James,

I was trying to execute something like these:

NamedQuery(name = "Auth.updateByAuthIds", query = "UPDATE Autha SET a.authState= :newState WHERE a.authPK IN :autorizacaoPK"),

authPK is a composite key:

@Embeddable
public class AuthPK implements Serializable {
@Basic(optional = false)
@Column(name = "Building_idBuilding")
private long buildingidBuilding;
@Basic(optional = false)
@Column(name = "Room_idRoom")
private long roomidRoom;
@Basic(optional = false)
@Column(name = "Person_idPerson")
private long personidPerson;


Tried to use an array of AuthPK...didn't work...

Re: Composite Key and IN Operator [message #684919 is a reply to message #683930] Thu, 16 June 2011 09:27 Go to previous message
Eclipse UserFriend
This is not supported. Please log an enhancement request.

A solution would be to dynamically build the query either through the JPA 2.0 Criteria API, JPQL, or SQL, (.i.e for each pk in the array compare the pk and AND together).
Previous Topic:CriteriaBuilder.isEmpty on an ElementCollection vs. JPQL approach
Next Topic:derived identifier of derived identifier
Goto Forum:
  


Current Time: Sun Nov 09 18:36:21 EST 2025

Powered by FUDForum. Page generated in 0.03552 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top