JPA Query with openJPA only works as 'native' SQL, but it does not when transformed as JPQL or with JPA Criteria -
i have sql query , mapping of classes. using openjpa, if query made @namednativequery works fine, returning correspondent class , expected result. if transformed jpql @namedquery returns noresultexception getsingleresult method. tried jpa criteria not working, @ least not in environments. cannot reproduce problem locally, occurs in test system. locally of approaches work ok.
i think configuration problem, haven't found anything.
sql: select * my_rel_table map map.type = ?1 , map.region_id = ?2
jpql: select m myrelationclass m m.type= :type , m.region = :region
does have idea wrong?
ibm openjpa, websphere 8.0
i cannot reproduce problem locally, occurs in test system.
are connecting same database in both environments? if not, possible local database doesn't have correct data in it?
you enable openjpa sql trace see jpql being translated to:
openjpa.log=sql=trace
also, set following property see parameter values :
openjpa.connectionfactoryproperties=printparameters=true