openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lsp06 <lspa...@gmail.com>
Subject Re: createQuery(String qlString, Class<T> resultClass) or createNamedQuery() usage
Date Fri, 06 May 2011 22:46:58 GMT
Not sure where you are defining your queries, but I've done something like
this having my queries in an xml.  In my case, I used a named-native-query
and set the result-class attribute to the ValueObject.  Here's part my query
file:

<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings version="1.0"
xmlns="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm
http://java.sun.com/xml/ns/persistence/orm_1_0.xsd">
    <named-native-query name="findUserObjByLastName" 
        result-class="com.mypackage.model.CUsers">
        <query></query>
    </named-native-query>
    <named-native-query name="findUserProjByLastName">
        <query></query>
    </named-native-query>
</entity-mappings>



--
View this message in context: http://openjpa.208410.n2.nabble.com/createQuery-String-qlString-Class-T-resultClass-or-createNamedQuery-usage-tp6338912p6339082.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message