[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] Query within a BasicCollection
|
Thank you.
So I will use expression builders instead of JPQL queries.
--Pierre-Olivier.
Gordon Yorke a écrit :
The JPQL support must not have been updated. Your best approach then
is to use a SessionCustomizer or DescriptorCustomizer to create a
native EclipseLink named query.
(http://wiki.eclipse.org/Introduction_to_EclipseLink_Queries_(ELUG)
and
http://wiki.eclipse.org/Introduction_to_EclipseLink_Queries_(ELUG)#Named_Queries
) and create an Expression like :
ReadAllQuery query = new ReadAllQuery(MyEntity.class);
query.setSelectionCriteria(query.getExpressionBuilder().anyOf("numbers").equal(10));
Then this query will be available through the standard JPA
createNamedQuery() call.
The JPQL updates will occur as we progress through our JPA 2.0
functionality.
--Gordon Yorke
Pierre-Olivier TERRISSE wrote:
I tried this query an I have this error message :
Exception in thread "main" java.lang.IllegalArgumentException: An
exception occurred while creating a query in EntityManager
at
org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:742)
at test.EclipseLinkTest.main(EclipseLinkTest.java:40)
Caused by: Exception [EclipseLink-8030] (Eclipse Persistence Services
- 1.0.2 (Build 20081024)):
org.eclipse.persistence.exceptions.JPQLException
Exception Description: Error compiling the query [select e from
MyEntity e where 10 member of e.numbers], line 1, column 46: unknown
state or association field [numbers] of class [test.entites.MyEntity].
--Pierre-Olivier.
Gordon Yorke a écrit :
The MEMBER OF syntax may work for you : " select e from MyEntity e
where 10 member of e.numbers"
--Gordon
Pierre-Olivier TERRISSE wrote:
Hello,
A begin with JPA Eclipse-Link and I need to query a database where
an entity contains a BasicCollection.
@Entity
public class MyEntity {
@BasicCollection(fetch=FetchType.EAGER)
private List<Integer> numbers = new ArrayList<Integer>();
}
I want to query all entities that contain a certain value within
the "numbers" attribute.
Query query = entityManager.createQuery("select e from MyEntity e
where e.numbers=10");
This does not work. What is the correct syntax ?
Thanks in advance,
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
begin:vcard
fn:Pierre-Olivier TERRISSE
n:TERRISSE;Pierre-Olivier
org;quoted-printable;quoted-printable:Universit=C3=A9 de Nantes;D.S.I. Direction des Syst=C3=A8mes d'Information
email;internet:Pierre-Olivier.Terrisse@xxxxxxxxxxxxxx
title;quoted-printable:Gestion de l'identit=C3=A9
version:2.1
end:vcard