flamant
flamant

Reputation: 783

How to construct a list of Custom object directly from a jpql query (hibernate)

I have the two following custom object

public class customDataObject_1 {
    private String number;
    private List<PartnerData> partnersDatas;
    private List<customDataObject_2> custom_list_2;
}
and 
public class customDataObject_2 {
    private String property1;
    private String property2;
    private String property3;
    private DataObject1 dataObject1;
    private DataObject2 dataObject2;
    private DataObject3 dataObject3;
}

In JPQL, I can get the following list of object Array: List by a query that is alike

String queryString = select orderNo, new package1.PartnerData(-), new package2.customDataObject_2(-,-,-,-,-,-) from -,-,-,- where ------;

After a java treatment I can get from the result of the request the following result: List#customDataObject_1#.

My question is: is it possible to get, without a java treatment, directly from a JPQL request the previous result, that is List#customDataObject_1# and if it is possible, how

Upvotes: 0

Views: 65

Answers (1)

Simon Martinelli
Simon Martinelli

Reputation: 36223

No you can't.

The result of a SQL query is always a table. So cannot get nested tables inside the result.

Upvotes: 1

Related Questions