[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.rt.eclipselink] how to

Hi,

Can someone help me to get the @SqlResultSetMapping to work?
I can not find any examples for mapping the result from calling SQL functions "min", "max" to the result object.


@NamedNativeQuery(name = "findIds", query = "select min(id) as minKey, max(id) as maxKey from account",
resultSetMapping = "KeyRange")
@SqlResultSetMapping(name = "KeyRange",
entities = { @EntityResult(entityClass=com.oracle.ngc.prototype.DataMigrator.KeyRange.class, fields = {
@FieldResult(name="min", column="minKey"),
@FieldResult(name="max", column="maxKey")
})})


With the above annotation, I got the following exception

[EPS Warning]: 2008.08.05 09:11:59.833--UnitOfWork(21697654)--java.lang.NullPointerException
Exception in thread "Thread-2" java.lang.NullPointerException
at org.eclipse.persistence.queries.EntityResult.getValueFromRecord(EntityResult.java:147)
at org.eclipse.persistence.queries.ResultSetMappingQuery.buildObjectsFromRecords(ResultSetMappingQuery.java:158)
at org.eclipse.persistence.queries.ResultSetMappingQuery.executeDatabaseQuery(ResultSetMappingQuery.java:206)
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:653)
at org.eclipse.persistence.queries.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:576)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2601)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1061)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1045)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1019)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1001)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.executeReadQuery(EJBQueryImpl.java:399)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.getResultList(EJBQueryImpl.java:517)



Thanks a lot. Jasper