diff --git a/annotations/src/main/java/org/hibernate/cfg/EJB3DTDEntityResolver.java b/annotations/src/main/java/org/hibernate/cfg/EJB3DTDEntityResolver.java
index d957bc020d..b75824c999 100644
--- a/annotations/src/main/java/org/hibernate/cfg/EJB3DTDEntityResolver.java
+++ b/annotations/src/main/java/org/hibernate/cfg/EJB3DTDEntityResolver.java
@@ -32,6 +32,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
+ * Resolve JPA xsd files locally
+ *
* @author Emmanuel Bernard
*/
public class EJB3DTDEntityResolver extends DTDEntityResolver {
@@ -41,49 +43,38 @@ public class EJB3DTDEntityResolver extends DTDEntityResolver {
boolean resolved = false;
+ /**
+ * Persistence.xml has been resolved locally
+ * @return true if it has
+ */
public boolean isResolved() {
return resolved;
}
public InputSource resolveEntity(String publicId, String systemId) {
+ log.trace("Resolving XML entity {} : {}", publicId, systemId);
InputSource is = super.resolveEntity( publicId, systemId );
if ( is == null ) {
if ( systemId != null ) {
if ( systemId.endsWith( "orm_1_0.xsd" ) ) {
- log.debug(
- "recognized EJB3 ORM namespace; attempting to resolve on classpath under org/hibernate/ejb"
- );
- String path = "org/hibernate/ejb/" + "orm_1_0.xsd";
- InputStream dtdStream = resolveInHibernateNamespace( path );
- if ( dtdStream == null ) {
- log.debug( "unable to locate [{}] on classpath", systemId );
- }
- else {
- log.debug( "located [{}] in classpath", systemId );
- InputSource source = new InputSource( dtdStream );
- source.setPublicId( publicId );
- source.setSystemId( systemId );
- resolved = false;
- return source;
- }
+ InputStream dtdStream = getStreamFromClasspath( "orm_1_0.xsd" );
+ final InputSource source = buildInputSource( publicId, systemId, dtdStream, false );
+ if (source != null) return source;
+ }
+ else if ( systemId.endsWith( "orm_2_0.xsd" ) ) {
+ InputStream dtdStream = getStreamFromClasspath( "orm_2_0.xsd" );
+ final InputSource source = buildInputSource( publicId, systemId, dtdStream, false );
+ if (source != null) return source;
}
else if ( systemId.endsWith( "persistence_1_0.xsd" ) ) {
- log.debug(
- "recognized EJB3 ORM namespace; attempting to resolve on classpath under org/hibernate/ejb"
- );
- String path = "org/hibernate/ejb/" + "persistence_1_0.xsd";
- InputStream dtdStream = resolveInHibernateNamespace( path );
- if ( dtdStream == null ) {
- log.debug( "unable to locate [{}] on classpath", systemId );
- }
- else {
- log.debug( "located [{}] in classpath", systemId );
- InputSource source = new InputSource( dtdStream );
- source.setPublicId( publicId );
- source.setSystemId( systemId );
- resolved = true;
- return source;
- }
+ InputStream dtdStream = getStreamFromClasspath( "persistence_1_0.xsd" );
+ final InputSource source = buildInputSource( publicId, systemId, dtdStream, true );
+ if (source != null) return source;
+ }
+ else if ( systemId.endsWith( "persistence_2_0.xsd" ) ) {
+ InputStream dtdStream = getStreamFromClasspath( "persistence_2_0.xsd" );
+ final InputSource source = buildInputSource( publicId, systemId, dtdStream, true );
+ if (source != null) return source;
}
}
}
@@ -94,4 +85,28 @@ public class EJB3DTDEntityResolver extends DTDEntityResolver {
//use the default behavior
return null;
}
+
+ private InputSource buildInputSource(String publicId, String systemId, InputStream dtdStream, boolean resolved) {
+ if ( dtdStream == null ) {
+ log.trace( "unable to locate [{}] on classpath", systemId );
+ return null;
+ }
+ else {
+ log.trace( "located [{}] in classpath", systemId );
+ InputSource source = new InputSource( dtdStream );
+ source.setPublicId( publicId );
+ source.setSystemId( systemId );
+ this.resolved = resolved;
+ return source;
+ }
+ }
+
+ private InputStream getStreamFromClasspath(String fileName) {
+ log.trace(
+ "recognized JPA ORM namespace; attempting to resolve on classpath under org/hibernate/ejb"
+ );
+ String path = "org/hibernate/ejb/" + fileName;
+ InputStream dtdStream = resolveInHibernateNamespace( path );
+ return dtdStream;
+ }
}
diff --git a/entitymanager/build.xml b/entitymanager/build.xml
index 7941e44e21..703f2821cb 100644
--- a/entitymanager/build.xml
+++ b/entitymanager/build.xml
@@ -45,6 +45,10 @@
+
+
+
+
diff --git a/entitymanager/pom.xml b/entitymanager/pom.xml
index f97f60693f..d81e28f1e5 100644
--- a/entitymanager/pom.xml
+++ b/entitymanager/pom.xml
@@ -181,6 +181,7 @@
${basedir}/target/test-packages/cfgxmlpar.par
${basedir}/target/test-packages/defaultpar.par
+ ${basedir}/target/test-packages/defaultpar_1_0.par
${basedir}/target/test-packages/excludehbmpar.par
${basedir}/target/test-packages/explicitpar.par
${basedir}/target/test-packages/explodedpar.par
diff --git a/entitymanager/src/main/java/org/hibernate/ejb/packaging/PersistenceXmlLoader.java b/entitymanager/src/main/java/org/hibernate/ejb/packaging/PersistenceXmlLoader.java
index c09fe51b78..90f64c44e5 100644
--- a/entitymanager/src/main/java/org/hibernate/ejb/packaging/PersistenceXmlLoader.java
+++ b/entitymanager/src/main/java/org/hibernate/ejb/packaging/PersistenceXmlLoader.java
@@ -84,19 +84,54 @@ public final class PersistenceXmlLoader {
final Validator v2Validator = v2Schema.newValidator();
final Schema v1Schema = SchemaFactory.newInstance( javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI )
.newSchema( new StreamSource( getStreamFromClasspath( "persistence_1_0.xsd" ) ) );
- final Validator v1Validator = v2Schema.newValidator();
+ final Validator v1Validator = v1Schema.newValidator();
InputSource source = new InputSource( is );
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
docBuilder.setEntityResolver( resolver );
- Document doc = docBuilder.parse( source );
+ List errors = new ArrayList();
+ Document doc = null;
+ try {
+ doc = docBuilder.parse( source );
+ }
+ catch ( SAXParseException e ) {
+ errors.add( e );
+ }
- List errors = new ArrayList();
- v2Validator.setErrorHandler( new ErrorLogger( "XML InputStream", errors, resolver ) );
- v2Validator.validate( new DOMSource( doc ) );
-
+ if (errors.size() == 0) {
+ v2Validator.setErrorHandler( new ErrorLogger( "XML InputStream", errors, resolver ) );
+ log.trace("Validate with persistence_2_0.xsd schema on file {}", configURL);
+ v2Validator.validate( new DOMSource( doc ) );
+ boolean isV1Schema = false;
+ if ( errors.size() != 0 ) {
+ //v2 fails, it could be because the file is v1.
+ log.trace("Found error with persistence_2_0.xsd schema on file {}", configURL);
+ SAXParseException exception = errors.get( 0 );
+ final String errorMessage = exception.getMessage();
+ isV1Schema = errorMessage.contains("1.0")
+ && errorMessage.contains("2.0")
+ && errorMessage.contains("version");
+
+ }
+ if (isV1Schema) {
+ log.trace("Validate with persistence_1_0.xsd schema on file {}", configURL);
+ errors.clear();
+ v1Validator.setErrorHandler( new ErrorLogger( "XML InputStream", errors, resolver ) );
+ v1Validator.validate( new DOMSource( doc ) );
+ }
+ }
if ( errors.size() != 0 ) {
- throw new PersistenceException( "Invlid persistence.xml. Check the error logs for parsing errors", (Throwable) errors.get( 0 ) );
+ StringBuilder errorMessage = new StringBuilder( );
+ for (SAXParseException error : errors) {
+ errorMessage.append("Error parsing XML (line")
+ .append(error.getLineNumber())
+ .append(" : column ")
+ .append(error.getColumnNumber())
+ .append("): ")
+ .append(error.getMessage())
+ .append("\n");
+ }
+ throw new PersistenceException( "Invalid persistence.xml.\n" + errorMessage.toString() );
}
return doc;
}
@@ -289,30 +324,14 @@ public final class PersistenceXmlLoader {
// if ( resolver instanceof EJB3DTDEntityResolver ) {
// if ( ( (EJB3DTDEntityResolver) resolver ).isResolved() == false ) return;
// }
-
- log.error( "Error parsing XML (line {}: column {}): {}",
- new Object[] {
- error.getLineNumber(),
- error.getColumnNumber(),
- error.getMessage() } );
errors.add( error );
}
public void fatalError(SAXParseException error) {
- log.error( "Error parsing XML (line {}: column {}): {}",
- new Object[] {
- error.getLineNumber(),
- error.getColumnNumber(),
- error.getMessage() } );
errors.add( error );
}
public void warning(SAXParseException warn) {
- log.warn( "Warning parsing XML (line {}: column {}): {}",
- new Object[] {
- warn.getLineNumber(),
- warn.getColumnNumber(),
- warn.getMessage() } );
}
}
diff --git a/entitymanager/src/test/bundles/defaultpar/META-INF/persistence.xml b/entitymanager/src/test/bundles/defaultpar/META-INF/persistence.xml
index e1c4545942..ffee9117c7 100644
--- a/entitymanager/src/test/bundles/defaultpar/META-INF/persistence.xml
+++ b/entitymanager/src/test/bundles/defaultpar/META-INF/persistence.xml
@@ -2,10 +2,11 @@
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
+ version="2.0">
org.hibernate.ejb.test.pack.defaultpar.Lighter
+ CALLBACK
diff --git a/entitymanager/src/test/bundles/defaultpar_1_0/META-INF/orm.xml b/entitymanager/src/test/bundles/defaultpar_1_0/META-INF/orm.xml
new file mode 100644
index 0000000000..b1c6f24846
--- /dev/null
+++ b/entitymanager/src/test/bundles/defaultpar_1_0/META-INF/orm.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ org.hibernate.ejb.test.pack.defaultpar_1_0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/entitymanager/src/test/bundles/defaultpar_1_0/META-INF/persistence.xml b/entitymanager/src/test/bundles/defaultpar_1_0/META-INF/persistence.xml
new file mode 100644
index 0000000000..8fa79a467d
--- /dev/null
+++ b/entitymanager/src/test/bundles/defaultpar_1_0/META-INF/persistence.xml
@@ -0,0 +1,19 @@
+
+
+
+
+ org.hibernate.ejb.test.pack.defaultpar.Lighter
+
+
+
+
+
+
+
+
+
+
+
diff --git a/entitymanager/src/test/bundles/defaultpar_1_0/org/hibernate/ejb/test/pack/defaultpar_1_0/Mouse1.hbm.xml b/entitymanager/src/test/bundles/defaultpar_1_0/org/hibernate/ejb/test/pack/defaultpar_1_0/Mouse1.hbm.xml
new file mode 100644
index 0000000000..0a59181fa1
--- /dev/null
+++ b/entitymanager/src/test/bundles/defaultpar_1_0/org/hibernate/ejb/test/pack/defaultpar_1_0/Mouse1.hbm.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/entitymanager/src/test/bundles/excludehbmpar/META-INF/persistence.xml b/entitymanager/src/test/bundles/excludehbmpar/META-INF/persistence.xml
index ee6bcad1a8..dd865447e9 100644
--- a/entitymanager/src/test/bundles/excludehbmpar/META-INF/persistence.xml
+++ b/entitymanager/src/test/bundles/excludehbmpar/META-INF/persistence.xml
@@ -2,8 +2,8 @@
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
+ version="2.0">
META-INF/orm2.xml
diff --git a/entitymanager/src/test/bundles/explicitpar/META-INF/persistence.xml b/entitymanager/src/test/bundles/explicitpar/META-INF/persistence.xml
index c3bca34750..517a8a0fca 100644
--- a/entitymanager/src/test/bundles/explicitpar/META-INF/persistence.xml
+++ b/entitymanager/src/test/bundles/explicitpar/META-INF/persistence.xml
@@ -1,8 +1,8 @@
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
+ version="2.0">
./target/test-packages/externaljar.jar
org.hibernate.ejb.test.Cat
diff --git a/entitymanager/src/test/bundles/explodedpar/META-INF/persistence.xml b/entitymanager/src/test/bundles/explodedpar/META-INF/persistence.xml
index 525c6f5b46..02542f10d0 100644
--- a/entitymanager/src/test/bundles/explodedpar/META-INF/persistence.xml
+++ b/entitymanager/src/test/bundles/explodedpar/META-INF/persistence.xml
@@ -2,8 +2,8 @@
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
+ version="2.0">
diff --git a/entitymanager/src/test/bundles/overridenpar/META-INF/persistence.xml b/entitymanager/src/test/bundles/overridenpar/META-INF/persistence.xml
index fd2b42542f..32e3a6e1f4 100644
--- a/entitymanager/src/test/bundles/overridenpar/META-INF/persistence.xml
+++ b/entitymanager/src/test/bundles/overridenpar/META-INF/persistence.xml
@@ -1,8 +1,8 @@
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
+ version="2.0">
java:/unreachableDS
diff --git a/entitymanager/src/test/bundles/space par/META-INF/persistence.xml b/entitymanager/src/test/bundles/space par/META-INF/persistence.xml
index 97b83c2314..9eec2be87d 100644
--- a/entitymanager/src/test/bundles/space par/META-INF/persistence.xml
+++ b/entitymanager/src/test/bundles/space par/META-INF/persistence.xml
@@ -2,8 +2,8 @@
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
+ version="2.0">
diff --git a/entitymanager/src/test/bundles/war/WEB-INF/classes/META-INF/persistence.xml b/entitymanager/src/test/bundles/war/WEB-INF/classes/META-INF/persistence.xml
index e1c4545942..7308173277 100644
--- a/entitymanager/src/test/bundles/war/WEB-INF/classes/META-INF/persistence.xml
+++ b/entitymanager/src/test/bundles/war/WEB-INF/classes/META-INF/persistence.xml
@@ -2,8 +2,8 @@
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
+ version="2.0">
org.hibernate.ejb.test.pack.defaultpar.Lighter
diff --git a/entitymanager/src/test/java/org/hibernate/ejb/test/PackagedEntityManagerTest.java b/entitymanager/src/test/java/org/hibernate/ejb/test/PackagedEntityManagerTest.java
index 97b5a53432..dda0661521 100644
--- a/entitymanager/src/test/java/org/hibernate/ejb/test/PackagedEntityManagerTest.java
+++ b/entitymanager/src/test/java/org/hibernate/ejb/test/PackagedEntityManagerTest.java
@@ -25,6 +25,10 @@ import org.hibernate.ejb.test.pack.externaljar.Scooter;
import org.hibernate.ejb.test.pack.spacepar.Bug;
import org.hibernate.ejb.test.pack.various.Airplane;
import org.hibernate.ejb.test.pack.various.Seat;
+import org.hibernate.ejb.test.pack.defaultpar_1_0.ApplicationServer1;
+import org.hibernate.ejb.test.pack.defaultpar_1_0.Version1;
+import org.hibernate.ejb.test.pack.defaultpar_1_0.Mouse1;
+import org.hibernate.ejb.test.pack.defaultpar_1_0.Lighter1;
import org.hibernate.engine.SessionImplementor;
import org.hibernate.event.EventListeners;
import org.hibernate.stat.Statistics;
@@ -74,6 +78,36 @@ public class PackagedEntityManagerTest extends TestCase {
emf.close();
}
+ public void testDefaultParForPersistence_1_0() throws Exception {
+ EntityManagerFactory emf = Persistence.createEntityManagerFactory( "defaultpar_1_0", new HashMap() );
+ EntityManager em = emf.createEntityManager();
+ ApplicationServer1 as = new ApplicationServer1();
+ as.setName( "JBoss AS" );
+ Version1 v = new Version1();
+ v.setMajor( 4 );
+ v.setMinor( 0 );
+ v.setMicro( 3 );
+ as.setVersion( v );
+ Mouse1 mouse = new Mouse1();
+ mouse.setName( "mickey" );
+ em.getTransaction().begin();
+ em.persist( as );
+ em.persist( mouse );
+ assertEquals( 1, em.createNamedQuery( "allMouse_1_0" ).getResultList().size() );
+ Lighter1 lighter = new Lighter1();
+ lighter.name = "main";
+ lighter.power = " 250 W";
+ em.persist( lighter );
+ em.flush();
+ em.remove( lighter );
+ em.remove( mouse );
+ assertNotNull( as.getId() );
+ em.remove( as );
+ em.getTransaction().commit();
+ em.close();
+ emf.close();
+ }
+
public void testListenersDefaultPar() throws Exception {
IncrementListener.reset();
OtherIncrementListener.reset();
diff --git a/entitymanager/src/test/java/org/hibernate/ejb/test/pack/defaultpar_1_0/ApplicationServer1.java b/entitymanager/src/test/java/org/hibernate/ejb/test/pack/defaultpar_1_0/ApplicationServer1.java
new file mode 100644
index 0000000000..e990f597e7
--- /dev/null
+++ b/entitymanager/src/test/java/org/hibernate/ejb/test/pack/defaultpar_1_0/ApplicationServer1.java
@@ -0,0 +1,42 @@
+//$Id$
+package org.hibernate.ejb.test.pack.defaultpar_1_0;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@Entity
+public class ApplicationServer1 {
+ private Integer id;
+ private String name;
+ private Version1 version;
+
+ @Id
+ @GeneratedValue
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Version1 getVersion() {
+ return version;
+ }
+
+ public void setVersion(Version1 version) {
+ this.version = version;
+ }
+}
\ No newline at end of file
diff --git a/entitymanager/src/test/java/org/hibernate/ejb/test/pack/defaultpar_1_0/IncrementListener1.java b/entitymanager/src/test/java/org/hibernate/ejb/test/pack/defaultpar_1_0/IncrementListener1.java
new file mode 100644
index 0000000000..44c385e187
--- /dev/null
+++ b/entitymanager/src/test/java/org/hibernate/ejb/test/pack/defaultpar_1_0/IncrementListener1.java
@@ -0,0 +1,24 @@
+//$Id$
+package org.hibernate.ejb.test.pack.defaultpar_1_0;
+
+import javax.persistence.PrePersist;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class IncrementListener1 {
+ private static int increment;
+
+ public static int getIncrement() {
+ return increment;
+ }
+
+ public static void reset() {
+ increment = 0;
+ }
+
+ @PrePersist
+ public void increment(Object entity) {
+ increment++;
+ }
+}
\ No newline at end of file
diff --git a/entitymanager/src/test/java/org/hibernate/ejb/test/pack/defaultpar_1_0/Lighter1.java b/entitymanager/src/test/java/org/hibernate/ejb/test/pack/defaultpar_1_0/Lighter1.java
new file mode 100644
index 0000000000..17ae925bd8
--- /dev/null
+++ b/entitymanager/src/test/java/org/hibernate/ejb/test/pack/defaultpar_1_0/Lighter1.java
@@ -0,0 +1,10 @@
+//$Id$
+package org.hibernate.ejb.test.pack.defaultpar_1_0;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class Lighter1 {
+ public String name;
+ public String power;
+}
\ No newline at end of file
diff --git a/entitymanager/src/test/java/org/hibernate/ejb/test/pack/defaultpar_1_0/Money1.java b/entitymanager/src/test/java/org/hibernate/ejb/test/pack/defaultpar_1_0/Money1.java
new file mode 100644
index 0000000000..5a199f6d08
--- /dev/null
+++ b/entitymanager/src/test/java/org/hibernate/ejb/test/pack/defaultpar_1_0/Money1.java
@@ -0,0 +1,24 @@
+//$Id$
+package org.hibernate.ejb.test.pack.defaultpar_1_0;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.GeneratedValue;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@Entity
+public class Money1 {
+ private Integer id;
+
+ @Id @GeneratedValue
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+}
\ No newline at end of file
diff --git a/entitymanager/src/test/java/org/hibernate/ejb/test/pack/defaultpar_1_0/Mouse1.java b/entitymanager/src/test/java/org/hibernate/ejb/test/pack/defaultpar_1_0/Mouse1.java
new file mode 100644
index 0000000000..bc9345894c
--- /dev/null
+++ b/entitymanager/src/test/java/org/hibernate/ejb/test/pack/defaultpar_1_0/Mouse1.java
@@ -0,0 +1,29 @@
+//$Id$
+package org.hibernate.ejb.test.pack.defaultpar_1_0;
+
+import javax.persistence.ExcludeDefaultListeners;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@ExcludeDefaultListeners
+public class Mouse1 {
+ private Integer id;
+ private String name;
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
\ No newline at end of file
diff --git a/entitymanager/src/test/java/org/hibernate/ejb/test/pack/defaultpar_1_0/OtherIncrementListener1.java b/entitymanager/src/test/java/org/hibernate/ejb/test/pack/defaultpar_1_0/OtherIncrementListener1.java
new file mode 100644
index 0000000000..d03489c978
--- /dev/null
+++ b/entitymanager/src/test/java/org/hibernate/ejb/test/pack/defaultpar_1_0/OtherIncrementListener1.java
@@ -0,0 +1,21 @@
+//$Id$
+package org.hibernate.ejb.test.pack.defaultpar_1_0;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class OtherIncrementListener1 {
+ private static int increment;
+
+ public static int getIncrement() {
+ return OtherIncrementListener1.increment;
+ }
+
+ public static void reset() {
+ increment = 0;
+ }
+
+ public void increment(Object entity) {
+ OtherIncrementListener1.increment++;
+ }
+}
\ No newline at end of file
diff --git a/entitymanager/src/test/java/org/hibernate/ejb/test/pack/defaultpar_1_0/Version1.java b/entitymanager/src/test/java/org/hibernate/ejb/test/pack/defaultpar_1_0/Version1.java
new file mode 100644
index 0000000000..e04251a769
--- /dev/null
+++ b/entitymanager/src/test/java/org/hibernate/ejb/test/pack/defaultpar_1_0/Version1.java
@@ -0,0 +1,43 @@
+//$Id$
+package org.hibernate.ejb.test.pack.defaultpar_1_0;
+
+import javax.persistence.Embeddable;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@Embeddable
+public class Version1 {
+ private static final String DOT = ".";
+ private int major;
+ private int minor;
+ private int micro;
+
+ public int getMajor() {
+ return major;
+ }
+
+ public void setMajor(int major) {
+ this.major = major;
+ }
+
+ public int getMinor() {
+ return minor;
+ }
+
+ public void setMinor(int minor) {
+ this.minor = minor;
+ }
+
+ public int getMicro() {
+ return micro;
+ }
+
+ public void setMicro(int micro) {
+ this.micro = micro;
+ }
+
+ public String toString() {
+ return new StringBuffer( major ).append( DOT ).append( minor ).append( DOT ).append( micro ).toString();
+ }
+}
\ No newline at end of file
diff --git a/entitymanager/src/test/java/org/hibernate/ejb/test/pack/defaultpar_1_0/package-info.java b/entitymanager/src/test/java/org/hibernate/ejb/test/pack/defaultpar_1_0/package-info.java
new file mode 100644
index 0000000000..291f8eb48d
--- /dev/null
+++ b/entitymanager/src/test/java/org/hibernate/ejb/test/pack/defaultpar_1_0/package-info.java
@@ -0,0 +1,5 @@
+@NamedQuery(name = "allMouse_1_0",
+ query = "select m from ApplicationServer1 m")
+package org.hibernate.ejb.test.pack.defaultpar_1_0;
+
+import org.hibernate.annotations.NamedQuery;
\ No newline at end of file