From d3b1a2e368b9df5924946fa48e971d09c4df7bc4 Mon Sep 17 00:00:00 2001 From: Albert Lee Date: Mon, 30 Mar 2009 17:06:32 +0000 Subject: [PATCH] OPENJPA-1005 - Set persistence.xml schema version for PersistenceUnitInfo interface. git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@760047 13f79535-47bb-0310-9956-ffa450edef68 --- .../openjpa/persistence/PersistenceProductDerivation.java | 3 ++- .../openjpa/persistence/PersistenceUnitInfoImpl.java | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java index 9fd0c64da..3232f2f6a 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java @@ -675,7 +675,8 @@ public class PersistenceProductDerivation throws SAXException { _info = new PersistenceUnitInfoImpl(); _info.setPersistenceUnitName(attrs.getValue("name")); - + _info.setPersistenceXMLSchemaVersion(_persistenceVersion); + // we only parse this ourselves outside a container, so default // transaction type to local String val = attrs.getValue("transaction-type"); diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceUnitInfoImpl.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceUnitInfoImpl.java index acc1b4838..ac410c1ab 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceUnitInfoImpl.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceUnitInfoImpl.java @@ -79,6 +79,7 @@ public class PersistenceUnitInfoImpl private DataSource _nonJtaDataSource; private boolean _excludeUnlisted; private URL _persistenceXmlFile; + private String _schemaVersion = "1.0"; // A persistence unit is defined by a persistence.xml file. The jar // file or directory whose META-INF directory contains the @@ -505,8 +506,11 @@ public class PersistenceUnitInfoImpl } public String PersistenceXMLSchemaVersion() { - throw new UnsupportedOperationException( - "JPA 2.0 - Method not yet implemented"); + return _schemaVersion; + } + + public void setPersistenceXMLSchemaVersion(String version) { + _schemaVersion = version; } public Caching getCaching() {