OPENJPA-926 Modify XML-based explicit access tests to use build-time enhancement

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@778831 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jeremy Bauer 2009-05-26 18:29:29 +00:00
parent 677ef4da30
commit 5b53615609
18 changed files with 387 additions and 68 deletions

View File

@ -179,7 +179,8 @@ public class AccessCode {
return mergeFieldCode(cCode, fCode);
} catch (IllegalStateException e) {
throw new UserException(_loc.get("access-illegal-merge",
fmd.getFullName(false), toString(fCode), toString(cCode)));
fmd.getFullName(false), toFieldString(fCode),
toClassString(cCode)));
}
}
@ -209,7 +210,7 @@ public class AccessCode {
return cCode;
else
throw new IllegalStateException("Can not merge field " +
toString(fCode) + " to class " + toString(cCode));
toFieldString(fCode) + " to class " + toClassString(cCode));
}
}
return cCode;
@ -228,9 +229,22 @@ public class AccessCode {
return FIELD;
return UNKNOWN;
}
public static String toString(int code) {
if (!isValidClassCode(code) || !isValidFieldCode(code))
public static String toFieldString(int code) {
if (!isValidFieldCode(code))
return "invalid code " + code;
if (code == UNKNOWN)
return "unknown access";
if (code == EMPTY)
return "empty access";
return (isMixed(code) ? "mixed " : "")
+ (isExplicit(code) ? "explicit " : "implicit ")
+ (isField(code) ? "field" : "property")
+ " access";
}
public static String toClassString(int code) {
if (!isValidClassCode(code))
return "invalid code " + code;
if (code == UNKNOWN)
return "unknown access";

View File

@ -682,12 +682,12 @@ public class ClassMetaData
return;
if (!AccessCode.isValidClassCode(type)) {
throw new IllegalArgumentException(_loc.get("access-type-invalid",
this, AccessCode.toString(type)).getMessage());
this, AccessCode.toClassString(type)).getMessage());
}
if (_accessType != AccessCode.UNKNOWN) { // changing access type
_repos.getLog().warn(_loc.get("access-type-change",
this, AccessCode.toString(type),
AccessCode.toString(_accessType)).getMessage());
this, AccessCode.toClassString(type),
AccessCode.toClassString(_accessType)).getMessage());
}
_accessType = type;
}
@ -2143,8 +2143,8 @@ public class ClassMetaData
int supCode = sup.getAccessType();
if (!AccessCode.isCompatibleSuper(_accessType, supCode))
throw new MetaDataException(_loc.get("access-inconsistent-inherit",
new Object[]{this, AccessCode.toString(_accessType),
sup, AccessCode.toString(supCode)}).toString());
new Object[]{this, AccessCode.toClassString(_accessType),
sup, AccessCode.toClassString(supCode)}).toString());
}
}

View File

@ -40,7 +40,8 @@ public class TestAccessCode extends TestCase {
// All odd codes other than 1 are invalid
for (int i = 3; i < 32; i += 2)
assertFalse("Not a valid Class Code: " + AccessCode.toString(i),
assertFalse("Not a valid Class Code: " +
AccessCode.toClassString(i),
AccessCode.isValidClassCode(i));
}
@ -59,7 +60,8 @@ public class TestAccessCode extends TestCase {
// any even code with MIXED bit set is invalid
for (int i = MIXED; i < 32; i += 2) {
assertFalse("Not a valid field code: " + AccessCode.toString(i),
assertFalse("Not a valid field code: " +
AccessCode.toFieldString(i),
AccessCode.isValidFieldCode(i));
}
}
@ -145,27 +147,31 @@ public class TestAccessCode extends TestCase {
}
public void testToString() {
assertEquals("explicit property access", AccessCode.toString(12));
assertEquals("explicit property access", AccessCode.toClassString(12));
}
void isValidClassCode(boolean flag, int v, int valid) {
assertEquals(v, valid);
if (flag)
assertTrue("Invalid Class Code: " +
AccessCode.toString(valid), AccessCode.isValidClassCode(valid));
AccessCode.toClassString(valid),
AccessCode.isValidClassCode(valid));
else
assertFalse("Wrong Valid Class Code: " +
AccessCode.toString(valid), AccessCode.isValidClassCode(valid));
AccessCode.toClassString(valid),
AccessCode.isValidClassCode(valid));
}
void isValidFieldCode(boolean flag, int v, int valid) {
assertEquals(v, valid);
if (flag)
assertTrue("Invalid Field Code: " +
AccessCode.toString(valid), AccessCode.isValidFieldCode(valid));
AccessCode.toFieldString(valid),
AccessCode.isValidFieldCode(valid));
else
assertFalse("Wrong Field Class Code: " +
AccessCode.toString(valid), AccessCode.isValidFieldCode(valid));
AccessCode.toFieldString(valid),
AccessCode.isValidFieldCode(valid));
}
void isProperty(boolean flag, int v, int valid) {

View File

@ -23,10 +23,10 @@ import javax.persistence.Query;
import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
import org.apache.openjpa.persistence.OpenJPAEntityManagerSPI;
import org.apache.openjpa.persistence.OpenJPAPersistence;
import org.apache.openjpa.persistence.access.xml.XMLDefFieldMixedPropAccess;
import org.apache.openjpa.persistence.access.xml.XMLDefPropMixedFieldAccess;
import org.apache.openjpa.persistence.access.xml.XMLFieldAccess;
import org.apache.openjpa.persistence.access.xml.XMLPropAccess;
import org.apache.openjpa.persistence.access.xml.XMLDefFieldMixedPropAccess2;
import org.apache.openjpa.persistence.access.xml.XMLDefPropMixedFieldAccess2;
import org.apache.openjpa.persistence.access.xml.XMLFieldAccess2;
import org.apache.openjpa.persistence.access.xml.XMLPropAccess2;
import org.apache.openjpa.persistence.test.SingleEMFTestCase;
public class TestDefaultAccess extends SingleEMFTestCase {
@ -101,7 +101,7 @@ public class TestDefaultAccess extends SingleEMFTestCase {
}
private void verifyDefaultFieldAccess(OpenJPAEntityManagerSPI em) {
XMLFieldAccess fa = new XMLFieldAccess();
XMLFieldAccess2 fa = new XMLFieldAccess2();
// Set the persistent field through a misnamed setter
fa.setStringField("XMLFieldAccess2");
@ -116,10 +116,10 @@ public class TestDefaultAccess extends SingleEMFTestCase {
Query qry = em.createNamedQuery("XMLFieldAccess2.query");
qry.setParameter("id", fa.getId());
qry.setParameter("strVal", "XMLFieldAccess2");
XMLFieldAccess fa2 = (XMLFieldAccess)qry.getSingleResult();
XMLFieldAccess2 fa2 = (XMLFieldAccess2)qry.getSingleResult();
assertEquals(fa.getId(), fa2.getId());
XMLDefFieldMixedPropAccess dfmpa = new XMLDefFieldMixedPropAccess();
XMLDefFieldMixedPropAccess2 dfmpa = new XMLDefFieldMixedPropAccess2();
// Call non-PC setter
dfmpa.setStrField("NonPCSetter");
// Call setter with property access
@ -136,8 +136,8 @@ public class TestDefaultAccess extends SingleEMFTestCase {
qry = em.createNamedQuery("XMLDFMPA2.query");
qry.setParameter("id", dfmpa.getId());
qry.setParameter("strVal", "XMLDFMPA2");
XMLDefFieldMixedPropAccess dfmpa2 =
(XMLDefFieldMixedPropAccess)qry.getSingleResult();
XMLDefFieldMixedPropAccess2 dfmpa2 =
(XMLDefFieldMixedPropAccess2)qry.getSingleResult();
assertEquals(dfmpa, dfmpa2);
assertEquals(dfmpa2.getStringField(), "XMLDFMPA2");
@ -154,7 +154,7 @@ public class TestDefaultAccess extends SingleEMFTestCase {
}
private void verifyDefaultPropertyAccess(OpenJPAEntityManagerSPI em) {
XMLPropAccess pa = new XMLPropAccess();
XMLPropAccess2 pa = new XMLPropAccess2();
// Set the persistent field through a mis-named setter
pa.setStrProp("PropertyAccess");
@ -169,10 +169,10 @@ public class TestDefaultAccess extends SingleEMFTestCase {
Query qry = em.createNamedQuery("XMLPropAccess2.query");
qry.setParameter("id", pa.getId());
qry.setParameter("strVal", "PropertyAccess");
XMLPropAccess pa2 = (XMLPropAccess)qry.getSingleResult();
XMLPropAccess2 pa2 = (XMLPropAccess2)qry.getSingleResult();
assertEquals(pa, pa2);
XMLDefPropMixedFieldAccess dpmfa = new XMLDefPropMixedFieldAccess();
XMLDefPropMixedFieldAccess2 dpmfa = new XMLDefPropMixedFieldAccess2();
// Call setter with underlying field access
dpmfa.setStrProp("XMLDPMFA2");
@ -187,8 +187,8 @@ public class TestDefaultAccess extends SingleEMFTestCase {
qry = em.createNamedQuery("XMLDPMFA2.query");
qry.setParameter("id", dpmfa.getId());
qry.setParameter("strVal", "XMLDPMFA2");
XMLDefPropMixedFieldAccess dpmfa2 =
(XMLDefPropMixedFieldAccess)qry.getSingleResult();
XMLDefPropMixedFieldAccess2 dpmfa2 =
(XMLDefPropMixedFieldAccess2)qry.getSingleResult();
assertEquals(dpmfa, dpmfa2);
assertEquals(dpmfa2.getStrProp(), "XMLDPMFA2");

View File

@ -26,29 +26,22 @@ import org.apache.openjpa.persistence.ArgumentException;
import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
import org.apache.openjpa.persistence.OpenJPAEntityManagerSPI;
import org.apache.openjpa.persistence.OpenJPAPersistence;
import org.apache.openjpa.persistence.access.EmbedMixedAccess;
import org.apache.openjpa.persistence.access.PropMixedEntity;
import org.apache.openjpa.persistence.test.AllowFailure;
import org.apache.openjpa.persistence.test.PersistenceTestCase;
import org.apache.openjpa.persistence.test.SingleEMFTestCase;
public class TestXMLExplicitAccess extends PersistenceTestCase {
private OpenJPAEntityManagerFactorySPI emf = null;
public class TestXMLExplicitAccess extends SingleEMFTestCase {
public void setUp() throws Exception {
super.setUp();
emf = (OpenJPAEntityManagerFactorySPI)OpenJPAPersistence.
createEntityManagerFactory("Access-1",
"org/apache/openjpa/persistence/access/" +
"access-persistence.xml");
}
public void tearDown() throws Exception {
super.tearDown();
if (emf != null) {
clear(emf);
emf.close();
}
}
@Override
protected String getPersistenceUnitName() {
return "Access-1";
}
/**
* Validates the use of field level access on an
@ -212,7 +205,7 @@ public class TestXMLExplicitAccess extends PersistenceTestCase {
public void testAbstractMappedSuperField() {
OpenJPAEntityManagerFactorySPI emf =
(OpenJPAEntityManagerFactorySPI)OpenJPAPersistence.
createEntityManagerFactory("Access-1",
createEntityManagerFactory("Access-XML",
"org/apache/openjpa/persistence/access/" +
"access-persistence.xml");
@ -268,7 +261,7 @@ public class TestXMLExplicitAccess extends PersistenceTestCase {
OpenJPAEntityManagerFactorySPI emf =
(OpenJPAEntityManagerFactorySPI)OpenJPAPersistence.
createEntityManagerFactory("Access-1",
createEntityManagerFactory("Access-XML",
"org/apache/openjpa/persistence/access/" +
"access-persistence.xml");
@ -325,7 +318,7 @@ public class TestXMLExplicitAccess extends PersistenceTestCase {
OpenJPAEntityManagerFactorySPI emf =
(OpenJPAEntityManagerFactorySPI)OpenJPAPersistence.
createEntityManagerFactory("Access-1",
createEntityManagerFactory("Access-XML",
"org/apache/openjpa/persistence/access/" +
"access-persistence.xml");
@ -785,5 +778,4 @@ public class TestXMLExplicitAccess extends PersistenceTestCase {
em.close();
}
}

View File

@ -0,0 +1,69 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.openjpa.persistence.access.xml;
public class XMLDefFieldMixedPropAccess2 {
private int id;
private int version;
private String strField;
public void setId(int id) {
this.id = id;
}
public int getId() {
return id;
}
public void setVersion(int version) {
this.version = version;
}
public int getVersion() {
return version;
}
public void setStringField(String val) {
strField = val;
}
public String getStringField() {
return strField;
}
public boolean equals(Object obj) {
if (obj instanceof XMLDefFieldMixedPropAccess2) {
XMLDefFieldMixedPropAccess2 fa = (XMLDefFieldMixedPropAccess2)obj;
return id == fa.getId() &&
getStringField().equals(fa.getStringField());
}
return false;
}
public void setStrField(String strField) {
this.strField = strField;
}
public String getStrField() {
return strField;
}
}

View File

@ -0,0 +1,69 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.openjpa.persistence.access.xml;
public class XMLDefPropMixedFieldAccess2 {
private int id;
private int version;
private String strField;
public void setId(int id) {
this.id = id;
}
public int getId() {
return id;
}
public void setVersion(int version) {
this.version = version;
}
public int getVersion() {
return version;
}
public void setStrProp(String var) {
this.setStrField(var);
}
public String getStrProp() {
return getStrField();
}
public boolean equals(Object obj) {
if (obj instanceof XMLDefPropMixedFieldAccess2) {
XMLDefPropMixedFieldAccess2 dpmfa = (XMLDefPropMixedFieldAccess2)obj;
return getId() == dpmfa.getId() &&
getStrField().equals(dpmfa.getStrProp());
}
return false;
}
public void setStrField(String strField) {
this.strField = strField;
}
public String getStrField() {
return strField;
}
}

View File

@ -0,0 +1,69 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.openjpa.persistence.access.xml;
public class XMLFieldAccess2 {
private int id;
private int version;
private String strField;
public void setId(int id) {
this.id = id;
}
public int getId() {
return id;
}
public void setVersion(int version) {
this.version = version;
}
public int getVersion() {
return version;
}
public void setStringField(String val) {
this.setStrField(val);
}
public String getStringField() {
return getStrField();
}
public boolean equals(Object obj) {
if (obj instanceof XMLFieldAccess2) {
XMLFieldAccess2 fa = (XMLFieldAccess2)obj;
return id == fa.getId() &&
getStrField().equals(fa.getStringField());
}
return false;
}
public void setStrField(String strField) {
this.strField = strField;
}
public String getStrField() {
return strField;
}
}

View File

@ -0,0 +1,61 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.openjpa.persistence.access.xml;
public class XMLPropAccess2 {
private int id;
private int version;
private String strField;
public void setId(int id) {
this.id = id;
}
public int getId() {
return id;
}
public void setVersion(int version) {
this.version = version;
}
public int getVersion() {
return version;
}
public void setStrProp(String var) {
this.strField = var;
}
public String getStrProp() {
return strField;
}
public boolean equals(Object obj) {
if (obj instanceof XMLPropAccess2) {
XMLPropAccess2 pa = (XMLPropAccess2)obj;
return getId() == pa.getId() &&
getStrProp().equals(pa.getStrProp());
}
return false;
}
}

View File

@ -40,6 +40,11 @@
</description>
<mapping-file>org/apache/openjpa/persistence/xml/orm.xml</mapping-file>
<mapping-file>org/apache/openjpa/persistence/embed/embed-orm.xml</mapping-file>
<mapping-file>org/apache/openjpa/persistence/access/access-orm.xml</mapping-file>
<mapping-file>org/apache/openjpa/persistence/access/access-def-field-orm.xml</mapping-file>
<mapping-file>org/apache/openjpa/persistence/access/access-def-prop-orm.xml</mapping-file>
<mapping-file>org/apache/openjpa/persistence/access/access-pudef-field-orm.xml</mapping-file>
<mapping-file>org/apache/openjpa/persistence/access/access-pudef-prop-orm.xml</mapping-file>
<properties>
<property name="openjpa.jdbc.SynchronizeMappings"
value="buildSchema(ForeignKeys=true)"/>
@ -128,4 +133,38 @@
</properties>
</persistence-unit>
<persistence-unit name="Access-1" transaction-type="RESOURCE_LOCAL">
<description>PU for access testing</description>
<mapping-file>
org/apache/openjpa/persistence/access/access-orm.xml
</mapping-file>
<class>org.apache.openjpa.persistence.access.xml.XMLAbstractMappedSuperField</class>
<class>org.apache.openjpa.persistence.access.xml.XMLAbstractMappedSuperProperty</class>
<class>org.apache.openjpa.persistence.access.xml.XMLDefFieldMixedPropAccess</class>
<class>org.apache.openjpa.persistence.access.xml.XMLDefPropMixedFieldAccess</class>
<class>org.apache.openjpa.persistence.access.xml.XMLEmbedFieldAccess</class>
<class>org.apache.openjpa.persistence.access.xml.XMLEmbedMixedAccess</class>
<class>org.apache.openjpa.persistence.access.xml.XMLEmbedPropAccess</class>
<class>org.apache.openjpa.persistence.access.xml.XMLFieldAccess</class>
<class>org.apache.openjpa.persistence.access.xml.XMLFieldEmbedEntity</class>
<class>org.apache.openjpa.persistence.access.xml.XMLFieldSub</class>
<class>org.apache.openjpa.persistence.access.xml.XMLFieldSub2</class>
<class>org.apache.openjpa.persistence.access.xml.XMLFieldSub3</class>
<class>org.apache.openjpa.persistence.access.xml.XMLMappedSuperField</class>
<class>org.apache.openjpa.persistence.access.xml.XMLMappedSuperProperty</class>
<class>org.apache.openjpa.persistence.access.xml.XMLMixedFieldSub</class>
<class>org.apache.openjpa.persistence.access.xml.XMLMixedMappedSuper</class>
<class>org.apache.openjpa.persistence.access.xml.XMLPropAccess</class>
<class>org.apache.openjpa.persistence.access.xml.XMLPropEmbedEntity</class>
<class>org.apache.openjpa.persistence.access.xml.XMLPropertySub</class>
<class>org.apache.openjpa.persistence.access.xml.XMLPropertySub2</class>
<class>org.apache.openjpa.persistence.access.xml.XMLPropertySub3</class>
<class>org.apache.openjpa.persistence.access.xml.XMLPropMixedEntity</class>
<class>org.apache.openjpa.persistence.access.xml.XMLSuperFieldEntity</class>
<class>org.apache.openjpa.persistence.access.xml.XMLSuperPropertyEntity</class>
<properties>
<property name="openjpa.jdbc.SynchronizeMappings"
value="buildSchema"/>
</properties>
</persistence-unit>
</persistence>

View File

@ -23,7 +23,7 @@
version="2.0">
<access>FIELD</access>
<entity name="XMLFieldAccess2"
class="org.apache.openjpa.persistence.access.xml.XMLFieldAccess">
class="org.apache.openjpa.persistence.access.xml.XMLFieldAccess2">
<named-query name="XMLFieldAccess2.query">
<query>SELECT xfa FROM XMLFieldAccess2 xfa WHERE
xfa.id = :id AND xfa.strField = :strVal
@ -39,7 +39,7 @@
</entity>
<entity name="XMLDFMPA2"
class=
"org.apache.openjpa.persistence.access.xml.XMLDefFieldMixedPropAccess">
"org.apache.openjpa.persistence.access.xml.XMLDefFieldMixedPropAccess2">
<named-query name="XMLDFMPA2.query">
<query>SELECT df FROM XMLDFMPA2 df WHERE
df.id = :id AND df.stringField = :strVal

View File

@ -31,9 +31,9 @@
<mapping-file>
org/apache/openjpa/persistence/access/access-def-prop-orm.xml
</mapping-file>
<class>org.apache.openjpa.persistence.access.xml.XMLPropAccess</class>
<class>org.apache.openjpa.persistence.access.xml.XMLPropAccess2</class>
<class>
org.apache.openjpa.persistence.access.xml.XMLDefPropMixedFieldAccess
org.apache.openjpa.persistence.access.xml.XMLDefPropMixedFieldAccess2
</class>
<properties>
<property name="openjpa.jdbc.SynchronizeMappings"
@ -49,9 +49,9 @@
<mapping-file>
org/apache/openjpa/persistence/access/access-def-field-orm.xml
</mapping-file>
<class>org.apache.openjpa.persistence.access.xml.XMLFieldAccess</class>
<class>org.apache.openjpa.persistence.access.xml.XMLFieldAccess2</class>
<class>
org.apache.openjpa.persistence.access.xml.XMLDefFieldMixedPropAccess
org.apache.openjpa.persistence.access.xml.XMLDefFieldMixedPropAccess2
</class>
<properties>
<property name="openjpa.jdbc.SynchronizeMappings"

View File

@ -24,7 +24,7 @@
<access>PROPERTY</access>
<entity name="XMLDPMFA2"
class=
"org.apache.openjpa.persistence.access.xml.XMLDefPropMixedFieldAccess">
"org.apache.openjpa.persistence.access.xml.XMLDefPropMixedFieldAccess2">
<named-query name="XMLDPMFA2.query">
<query>SELECT dp FROM XMLDPMFA2 dp WHERE
dp.id = :id AND dp.strField = :strVal
@ -45,7 +45,7 @@
</attributes>
</entity>
<entity name="XMLPropAccess2"
class="org.apache.openjpa.persistence.access.xml.XMLPropAccess">
class="org.apache.openjpa.persistence.access.xml.XMLPropAccess2">
<named-query name="XMLPropAccess2.query">
<query>SELECT xpa FROM XMLPropAccess2 xpa WHERE
xpa.id = :id AND xpa.strProp = :strVal

View File

@ -23,7 +23,7 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0" >
<persistence-unit name="Access-1" transaction-type="RESOURCE_LOCAL">
<persistence-unit name="Access-XML" transaction-type="RESOURCE_LOCAL">
<description>PU for access testing</description>
<provider>
org.apache.openjpa.persistence.PersistenceProviderImpl

View File

@ -27,7 +27,7 @@
</persistence-unit-defaults>
</persistence-unit-metadata>
<entity name="XMLFieldAccess2"
class="org.apache.openjpa.persistence.access.xml.XMLFieldAccess">
class="org.apache.openjpa.persistence.access.xml.XMLFieldAccess2">
<named-query name="XMLFieldAccess2.query">
<query>SELECT xfa FROM XMLFieldAccess2 xfa WHERE
xfa.id = :id AND xfa.strField = :strVal
@ -43,7 +43,7 @@
</entity>
<entity name="XMLDFMPA2"
class=
"org.apache.openjpa.persistence.access.xml.XMLDefFieldMixedPropAccess">
"org.apache.openjpa.persistence.access.xml.XMLDefFieldMixedPropAccess2">
<named-query name="XMLDFMPA2.query">
<query>SELECT df FROM XMLDFMPA2 df WHERE
df.id = :id AND df.stringField = :strVal

View File

@ -31,9 +31,9 @@
<mapping-file>
org/apache/openjpa/persistence/access/access-pudef-prop-orm.xml
</mapping-file>
<class>org.apache.openjpa.persistence.access.xml.XMLPropAccess</class>
<class>org.apache.openjpa.persistence.access.xml.XMLPropAccess2</class>
<class>
org.apache.openjpa.persistence.access.xml.XMLDefPropMixedFieldAccess
org.apache.openjpa.persistence.access.xml.XMLDefPropMixedFieldAccess2
</class>
<properties>
<property name="openjpa.jdbc.SynchronizeMappings"
@ -49,9 +49,9 @@
<mapping-file>
org/apache/openjpa/persistence/access/access-pudef-field-orm.xml
</mapping-file>
<class>org.apache.openjpa.persistence.access.xml.XMLFieldAccess</class>
<class>org.apache.openjpa.persistence.access.xml.XMLFieldAccess2</class>
<class>
org.apache.openjpa.persistence.access.xml.XMLDefFieldMixedPropAccess
org.apache.openjpa.persistence.access.xml.XMLDefFieldMixedPropAccess2
</class>
<properties>
<property name="openjpa.jdbc.SynchronizeMappings"

View File

@ -28,7 +28,7 @@
</persistence-unit-metadata>
<entity name="XMLDPMFA2"
class=
"org.apache.openjpa.persistence.access.xml.XMLDefPropMixedFieldAccess">
"org.apache.openjpa.persistence.access.xml.XMLDefPropMixedFieldAccess2">
<named-query name="XMLDPMFA2.query">
<query>SELECT dp FROM XMLDPMFA2 dp WHERE
dp.id = :id AND dp.strField = :strVal
@ -49,7 +49,7 @@
</attributes>
</entity>
<entity name="XMLPropAccess2"
class="org.apache.openjpa.persistence.access.xml.XMLPropAccess">
class="org.apache.openjpa.persistence.access.xml.XMLPropAccess2">
<named-query name="XMLPropAccess2.query">
<query>SELECT xpa FROM XMLPropAccess2 xpa WHERE
xpa.id = :id AND xpa.strProp = :strVal

View File

@ -645,7 +645,7 @@ public class PersistenceMetaDataDefaults
}
} else {
throw new InternalException(meta + " " +
AccessCode.toString(meta.getAccessType()));
AccessCode.toClassString(meta.getAccessType()));
}
}