Re: Mapping native query results to POJO


Andy
 
Edited

Down to interpretation whether that is part of the JPA spec or not (the JPA spec is inexplicit as ever), but we consider it to be.
In the simplest case—i.e., when the results of the query are limited to entities of a single entity class andthe mapping information can be derived from the columns of the SQL result and the object/relational mapping metadata—it is sufficient to specify only the expected class of the entity result.
The JDO API defines what we support as required handling, so you get it with JPA for free.
You can either have a constructor with arguments the same in type as the result columns, or a default constructor plus setters for properties with those column names.

Join main@datanucleus.groups.io to automatically receive all group messages.