hi,
I am using Eclipse Link name native query, i define it in ORM.xml file. I use DB2.
I got a problem, i must specify the schema for the query native SQL. If i remove the schema, it tells me the object has not defined yet.
The Code as below :
ORM.xml
<persistence-unit-metadata>
<persistence-unit-defaults>
<schema>DO3</schema>
</persistence-unit-defaults>
</persistence-unit-metadata>
<named-native-query name="NATIVE_QUERY" result-set-mapping="returnCustomerSetInfo">
<query>
SELECT C76.CUSTOMER_SET_ID, C76.SET_LEVEL_BENEFIT_CD, E20.CUSTOMER_SET_TYPE_LNG_NM
FROM
DO3.C76_A999 C76
WHERE C76.CUSTOMER_SET_TYPE_ID = (
SELECT E20.CUSTOMER_SET_TYPE_ID FROM
DO3.E20_A999 E20
WHERE E20.CUSTOMER_SET_TYPE_CD = ?typeCode )
</query>
</named-native-query>
java:
Query query = entityManager.createNamedQuery("NATIVE_QUERY");
query.setParameter("typeCode", "BN");
@SuppressWarnings("rawtypes")
List resultList = query.getResultList();
but i check lots of infomation, all of them has not specify schema in native query. Is there any way I can do without specifying a schema ?
Any comment i appreciate .