Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Composite Key and IN Operator
Composite Key and IN Operator [message #677422] Wed, 08 June 2011 13:14 Go to next message
LA  is currently offline LA Friend
Messages: 13
Registered: June 2011
Junior Member
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 17:06 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

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 : Wiki : Book : Blog : Twitter
(no subject) [message #683408 is a reply to message #677422] Mon, 13 June 2011 17:06 Go to previous messageGo to next message
James is currently offline JamesFriend
Messages: 272
Registered: July 2009
Senior Member
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 17:06 Go to previous messageGo to next message
James is currently offline JamesFriend
Messages: 272
Registered: July 2009
Senior Member
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 17:15 Go to previous messageGo to next message
LA  is currently offline LA Friend
Messages: 13
Registered: June 2011
Junior Member
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 13:27 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

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).


James : Wiki : Book : Blog : Twitter
Previous Topic:CriteriaBuilder.isEmpty on an ElementCollection vs. JPQL approach
Next Topic:derived identifier of derived identifier
Goto Forum:
  


Current Time: Fri Mar 29 02:35:32 GMT 2024

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

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

Back to the top