Best practices using JPA to load object from query with a list member <p>I'm getting started with JPA and I want to know the best way to achieve something like this: I need to implement a service that returns a list of scripts, and each script has a list of parameters. I simplified the query, but it is something like this:</p> <pre><code>(SELECT p.DESC FROM INPUT_PARAMETERS p INNER JOIN SCRIPT_PARAMS sp ON p.PARAM_ID = sc.PARAM_I INNER JOIN SCRIPT s ON s.SCRIPT_ID = sc.SCRIPT_ID WHERE s.NAME = 'name') UNION (SELECT p.DESC FROM OUPUT_PARAMETERS p INNER JOIN SCRIPT_PARAMS sp ON p.PARAM_ID = sc.PARAM_I INNER JOIN SCRIPT s ON s.SCRIPT_ID = sc.SCRIPT_ID WHERE s.NAME = 'name') </code></pre> <p>And I want to return a list of POJO objects that are something like:</p> <pre><code>public class Script { private String name; private List&lt;String&gt; params; public Script(){} public String getName() { return name; } public void setName(String pName) { name = pName; } public List&lt;String&gt; getParams() { return params; } public void setParams(List&lt;String&gt; pParams) { params = pParams; } } </code></pre> <p>I want to know what is the best way to load the POJO object from a query. Is it best to build a JPQL query, or can I use a Native Named Query, and do I need to get a object[] and construct my POJOs manually, or can I use JPA to load the objects from the query?</p>