[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] Subqueries in JPA is not working with OpenJPA
|
This is not supported by JPA. Perhaps use a native query.
Green Beret wrote:
>
> Does JPA support subqueries in the select part of the main query.
>
> For example :
>
> SELECT record1.txnId, record1.accessTime, (SELECT record2.accessTime FROM
> Metering record2 WHERE record2.txnId=record1.txnId AND
> record2.action='END') FROM Metering record1 WHERE record1.action='START'
>
> The above query is properly working with Hibernate implementation. But
> when i use OpenJPA implementation instead of Hibernate implementation it
> is giving the following error:
>
> org.springframework.dao.InvalidDataAccessApiUsageException: Encountered
> "(" at character 44, but expected: ["ABS", "AVG", "CONCAT", "COUNT",
> "CURRENT_DATE", "CURRENT_TIME", "CURRENT_TIMESTAMP", "LENGTH", "LOCATE",
> "LOWER", "MAX", "MIN", "MOD", "NEW", "OBJECT", "SIZE", "SQRT",
> "SUBSTRING", "SUM", "TRIM", "UPPER", <IDENTIFIER>].; nested exception is
> <openjpa-1.2.1-r752877:753278 nonfatal user error>
> org.apache.openjpa.persistence.ArgumentException: Encountered "(" at
> character 44, but expected: ["ABS", "AVG", "CONCAT", "COUNT",
> "CURRENT_DATE", "CURRENT_TIME", "CURRENT_TIMESTAMP", "LENGTH", "LOCATE",
> "LOWER", "MAX", "MIN", "MOD", "NEW", "OBJECT", "SIZE", "SQRT",
> "SUBSTRING", "SUM", "TRIM", "UPPER", <IDENTIFIER>].
>
-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland
http://www.eclipse.org/eclipselink/
EclipseLink , http://www.oracle.com/technology/products/ias/toplink/
TopLink
Wiki: http://wiki.eclipse.org/EclipseLink EclipseLink ,
http://wiki.oracle.com/page/TopLink TopLink
Forums: http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink ,
http://www.nabble.com/EclipseLink-f26430.html EclipseLink
Book: http://en.wikibooks.org/wiki/Java_Persistence Java Persistence
--
View this message in context: http://www.nabble.com/Subqueries-in-JPA-is-not-working-with-OpenJPA-tp24696739p24702362.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.