mirror of https://github.com/apache/openjpa.git
OPENJPA-2601 fix 'hint' element in orm.xml parsing
Txs to Kariem Hussein for the patch! git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1692088 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c4db9b05b8
commit
41c05d1bbe
|
@ -23,6 +23,9 @@ import java.util.Arrays;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.openjpa.kernel.QueryHints;
|
||||
import org.apache.openjpa.meta.QueryMetaData;
|
||||
import org.apache.openjpa.persistence.meta.MetamodelImpl;
|
||||
import org.apache.openjpa.persistence.test.SQLListenerTestCase;
|
||||
import javax.persistence.*;
|
||||
|
||||
|
@ -161,7 +164,14 @@ public class TestXMLPersistenceMetaDataParser extends SQLListenerTestCase {
|
|||
em.close();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void testQueryHintOrmXml() {
|
||||
QueryMetaData[] meta = ((MetamodelImpl) emf.getMetamodel()).getRepository().getQueryMetaDatas();
|
||||
assertEquals(1, meta.length);
|
||||
assertEquals("Country1.literal", meta[0].getName());
|
||||
assertEquals(1, meta[0].getHintKeys().length);
|
||||
assertEquals(QueryHints.HINT_USE_LITERAL_IN_SQL, meta[0].getHintKeys()[0]);
|
||||
}
|
||||
|
||||
private void printArrayList(ArrayList aList) {
|
||||
Iterator itr = aList.iterator();
|
||||
|
|
|
@ -22,6 +22,10 @@
|
|||
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_1_0.xsd"
|
||||
version="1.0">
|
||||
<package>org.apache.openjpa.persistence</package>
|
||||
<named-query name="Country1.literal">
|
||||
<query>Select c from Country1 c where c.name = 'literal'</query>
|
||||
<hint name="openjpa.hint.UseLiteralInSQL" value="true" />
|
||||
</named-query>
|
||||
<entity class="Security1">
|
||||
<table name="SECURITY1" />
|
||||
<attributes>
|
||||
|
|
|
@ -170,7 +170,7 @@ public class XMLPersistenceMetaDataParser
|
|||
|
||||
_elems.put("named-query", QUERY);
|
||||
_elems.put("named-native-query", NATIVE_QUERY);
|
||||
_elems.put("query-hint", QUERY_HINT);
|
||||
_elems.put("hint", QUERY_HINT);
|
||||
_elems.put("query", QUERY_STRING);
|
||||
|
||||
_elems.put("flush-mode", FLUSH_MODE);
|
||||
|
|
Loading…
Reference in New Issue