RESOLVED: retrieving some fields from an Entity [message #826037] |
Wed, 21 March 2012 15:20 |
FiruzzZ Mising name Messages: 19 Registered: October 2011 |
Junior Member |
|
|
The class Producto got more than 20 attributes, but i need to performance a faster and always QueryHints.REFRESH == TRUE query AND just get 3 fields (id, code, name)
I was using this one (when i used TopLink)...
@SqlResultSetMappings({
//para los ComboBox
@SqlResultSetMapping(name = "ProductoToBuscador", entities = {
@EntityResult(entityClass = Producto.class, fields = {
@FieldResult(name = "id", column = "id"),
@FieldResult(name = "codigo", column = "codigo"),
@FieldResult(name = "nombre", column = "nombre")
})
}),
..but doesn't work with Eclipselink, it's throwing:
java.lang.ClassCastException: org.eclipse.persistence.queries.ResultSetMappingQuery cannot be cast to org.eclipse.persistence.queries.ObjectLevelReadQuery
Some ppl say that the NativeQuery should retrieve all the fields of the entity ( "SELECT p.*"), another say just what you need ( SELECT p.id, p.codigo, p.nombre), but noone of these are working..
I really need a hand on this.. thanks in advances for any help
[Updated on: Thu, 22 March 2012 14:13] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04652 seconds