Hibernate SVN: r20853 - in tools/trunk: lib/testlibs and 6 other directories.
by hibernate-commits@lists.jboss.org
Author: dgeraskov
Date: 2010-10-27 10:36:12 -0400 (Wed, 27 Oct 2010)
New Revision: 20853
Added:
tools/trunk/lib/testlibs/hibernate-jpa-2.0-api-1.0.0.Final.jar
Removed:
tools/trunk/lib/testlibs/ejb3-persistence.jar
tools/trunk/lib/testlibs/hibernate-annotations.jar
tools/trunk/lib/testlibs/hibernate-commons-annotations.jar
tools/trunk/lib/testlibs/hibernate-entitymanager.jar
Modified:
tools/trunk/lib/testlibs/hibernate3.jar
tools/trunk/pom.xml
tools/trunk/src/java/org/hibernate/cfg/JDBCMetaDataConfiguration.java
tools/trunk/src/java/org/hibernate/tool/hbm2x/Cfg2HbmTool.java
tools/trunk/src/java/org/hibernate/tool/hbm2x/Cfg2JavaTool.java
tools/trunk/src/java/org/hibernate/tool/hbm2x/pojo/EntityPOJOClass.java
tools/trunk/src/java/org/hibernate/tool/hbmlint/detector/SchemaByMetaDataDetector.java
tools/trunk/src/test/org/hibernate/tool/hbm2x/Hbm2EJBDaoTest.java
tools/trunk/src/test/org/hibernate/tool/hbm2x/Hbm2JavaEjb3Test.java
tools/trunk/src/test/org/hibernate/tool/hbm2x/JdbcHbm2JavaEjb3Test.java
tools/trunk/src/test/org/hibernate/tool/test/jdbc2cfg/OneToOneTest.java
tools/trunk/src/test/org/hibernate/tool/test/jdbc2cfg/PerformanceTest.java
Log:
JBIDE-7386
Migrate Hibernate tools to hibernate3.5.6
Deleted: tools/trunk/lib/testlibs/ejb3-persistence.jar
===================================================================
(Binary files differ)
Deleted: tools/trunk/lib/testlibs/hibernate-annotations.jar
===================================================================
(Binary files differ)
Deleted: tools/trunk/lib/testlibs/hibernate-commons-annotations.jar
===================================================================
(Binary files differ)
Deleted: tools/trunk/lib/testlibs/hibernate-entitymanager.jar
===================================================================
(Binary files differ)
Added: tools/trunk/lib/testlibs/hibernate-jpa-2.0-api-1.0.0.Final.jar
===================================================================
(Binary files differ)
Property changes on: tools/trunk/lib/testlibs/hibernate-jpa-2.0-api-1.0.0.Final.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: tools/trunk/lib/testlibs/hibernate3.jar
===================================================================
(Binary files differ)
Modified: tools/trunk/pom.xml
===================================================================
--- tools/trunk/pom.xml 2010-10-15 15:28:00 UTC (rev 20852)
+++ tools/trunk/pom.xml 2010-10-27 14:36:12 UTC (rev 20853)
@@ -5,7 +5,7 @@
<groupId>org.hibernate</groupId>
<artifactId>hibernate-tools</artifactId>
- <version>3.4.0.Beta1</version>
+ <version>3.4.0.Beta2</version>
<packaging>jar</packaging>
<issueManagement>
@@ -45,10 +45,8 @@
<description>The core functionality of Hibernate Tools</description>
<properties>
- <hibernateVersion>3.3.2.GA</hibernateVersion>
- <hibernateAnnotationsVersion>3.3.0.ga</hibernateAnnotationsVersion>
- <hibernateEntitymanagerVersion>3.3.1.ga</hibernateEntitymanagerVersion>
- <hibernateCommonsAnnotationVersion>3.3.0.ga</hibernateCommonsAnnotationVersion>
+ <hibernateVersion>3.5.6-Final</hibernateVersion>
+ <hibernateJpaVersion>1.0.0.Final</hibernateJpaVersion>
<hsqldbVersion>1.8.0.2</hsqldbVersion>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
@@ -68,27 +66,39 @@
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
- <artifactId>hibernate-commons-annotations</artifactId>
- <version>${hibernateCommonsAnnotationVersion}</version>
+ <artifactId>hibernate-annotations</artifactId>
+ <version>${hibernateVersion}</version>
<scope>compile</scope>
</dependency>
<dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-entitymanager</artifactId>
+ <version>${hibernateVersion}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate.javax.persistence</groupId>
+ <artifactId>hibernate-jpa-2.0-api</artifactId>
+ <version>${hibernateJpaVersion}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.1</version>
<scope>compile</scope>
</dependency>
<dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-annotations</artifactId>
- <version>${hibernateAnnotationsVersion}</version>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
<scope>compile</scope>
</dependency>
<dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-entitymanager</artifactId>
- <version>${hibernateEntitymanagerVersion}</version>
- <scope>compile</scope>
+ <groupId>cglib</groupId>
+ <artifactId>cglib</artifactId>
+ <version>2.2</version>
+ <scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
Modified: tools/trunk/src/java/org/hibernate/cfg/JDBCMetaDataConfiguration.java
===================================================================
--- tools/trunk/src/java/org/hibernate/cfg/JDBCMetaDataConfiguration.java 2010-10-15 15:28:00 UTC (rev 20852)
+++ tools/trunk/src/java/org/hibernate/cfg/JDBCMetaDataConfiguration.java 2010-10-27 14:36:12 UTC (rev 20853)
@@ -13,6 +13,7 @@
import org.hibernate.cfg.reveng.DefaultReverseEngineeringStrategy;
import org.hibernate.cfg.reveng.ReverseEngineeringStrategy;
import org.hibernate.engine.Mapping;
+import org.hibernate.id.factory.IdentifierGeneratorFactory;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Property;
import org.hibernate.mapping.Table;
@@ -68,6 +69,10 @@
if (prop==null) throw new MappingException("property not known: " + persistentClass + '.' + propertyName);
return prop.getType();
}
+
+ public IdentifierGeneratorFactory getIdentifierGeneratorFactory() {
+ return null;
+ }
};
}
Modified: tools/trunk/src/java/org/hibernate/tool/hbm2x/Cfg2HbmTool.java
===================================================================
--- tools/trunk/src/java/org/hibernate/tool/hbm2x/Cfg2HbmTool.java 2010-10-15 15:28:00 UTC (rev 20852)
+++ tools/trunk/src/java/org/hibernate/tool/hbm2x/Cfg2HbmTool.java 2010-10-27 14:36:12 UTC (rev 20853)
@@ -3,7 +3,6 @@
*/
package org.hibernate.tool.hbm2x;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
@@ -16,6 +15,7 @@
import org.hibernate.engine.query.sql.NativeSQLQueryJoinReturn;
import org.hibernate.engine.query.sql.NativeSQLQueryReturn;
import org.hibernate.engine.query.sql.NativeSQLQueryRootReturn;
+import org.hibernate.id.PersistentIdentifierGenerator;
import org.hibernate.mapping.Any;
import org.hibernate.mapping.Collection;
import org.hibernate.mapping.Column;
@@ -79,6 +79,27 @@
}
}
+ /**
+ * Remove any internal keys from the set, eg, any Keys that are prefixed by
+ * 'target_', {@link PersistentIdentifierGenerator.IDENTIFIER_NORMALIZER} and return the filtered collection.
+ *
+ * @param properties
+ * @return
+ */
+ static Properties getFilteredIdentifierGeneratorProperties(Properties properties) {
+ if (properties != null){
+ Properties fProp = new Properties();
+ Iterator itr = properties.keySet().iterator();
+ while (itr.hasNext() ) {
+ String key = (String) itr.next();
+ if (! (key.startsWith("target_") || key.equals(PersistentIdentifierGenerator.IDENTIFIER_NORMALIZER)))
+ fProp.put(key, properties.get(key));
+ }
+ return fProp;
+ }
+ return null;
+ }
+
public String getTag(PersistentClass pc) {
return (String) pc.accept(HBMTagForPersistentClassVisitor.INSTANCE);
}
@@ -138,22 +159,11 @@
}
/**
- * Remove any internal keys from the set, eg, any Keys that are prefixed by
- * 'target_' and return the filtered collection.
- *
* @param property
* @return
*/
public Set getFilteredIdentifierGeneratorKeySet(Property property) {
- Set sval = new HashSet();
- Properties pval = this.getIdentifierGeneratorProperties(property);
- Iterator itr = pval.keySet().iterator();
- while (itr.hasNext() ) {
- String key = (String) itr.next();
- if (! key.startsWith("target_") )
- sval.add(key);
- }
- return sval;
+ return getFilteredIdentifierGeneratorProperties(this.getIdentifierGeneratorProperties(property)).keySet();
}
public boolean isOneToMany(Property property) {
Modified: tools/trunk/src/java/org/hibernate/tool/hbm2x/Cfg2JavaTool.java
===================================================================
--- tools/trunk/src/java/org/hibernate/tool/hbm2x/Cfg2JavaTool.java 2010-10-15 15:28:00 UTC (rev 20852)
+++ tools/trunk/src/java/org/hibernate/tool/hbm2x/Cfg2JavaTool.java 2010-10-27 14:36:12 UTC (rev 20853)
@@ -11,12 +11,12 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Properties;
import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Hibernate;
-import org.hibernate.HibernateException;
import org.hibernate.cfg.reveng.ReverseEngineeringStrategyUtil;
import org.hibernate.mapping.Array;
import org.hibernate.mapping.Collection;
@@ -24,11 +24,9 @@
import org.hibernate.mapping.IndexedCollection;
import org.hibernate.mapping.MetaAttributable;
import org.hibernate.mapping.MetaAttribute;
-import org.hibernate.mapping.OneToMany;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Property;
import org.hibernate.mapping.SimpleValue;
-import org.hibernate.mapping.ToOne;
import org.hibernate.mapping.Value;
import org.hibernate.tool.hbm2x.pojo.ComponentPOJOClass;
import org.hibernate.tool.hbm2x.pojo.EntityPOJOClass;
@@ -36,8 +34,6 @@
import org.hibernate.tool.hbm2x.pojo.NoopImportContext;
import org.hibernate.tool.hbm2x.pojo.POJOClass;
import org.hibernate.tool.hbm2x.visitor.JavaTypeFromValueVisitor;
-import org.hibernate.type.CompositeCustomType;
-import org.hibernate.type.CustomType;
import org.hibernate.type.PrimitiveType;
import org.hibernate.type.Type;
import org.hibernate.type.TypeFactory;
@@ -293,6 +289,15 @@
String decl = "<" + genericDecl + ">";
return decl;
}
+
+ /**
+ * @param simpleValue
+ * @return
+ */
+ public Properties getFilteredIdentifierGeneratorProperties(SimpleValue simpleValue) {
+ Properties p = simpleValue.getIdentifierGeneratorProperties();
+ return Cfg2HbmTool.getFilteredIdentifierGeneratorProperties(p);
+ }
private String getJavaTypeName(Value value, boolean preferRawTypeNames) {
return (String) value.accept( new JavaTypeFromValueVisitor() );
Modified: tools/trunk/src/java/org/hibernate/tool/hbm2x/pojo/EntityPOJOClass.java
===================================================================
--- tools/trunk/src/java/org/hibernate/tool/hbm2x/pojo/EntityPOJOClass.java 2010-10-15 15:28:00 UTC (rev 20852)
+++ tools/trunk/src/java/org/hibernate/tool/hbm2x/pojo/EntityPOJOClass.java 2010-10-27 14:36:12 UTC (rev 20853)
@@ -22,7 +22,6 @@
import org.hibernate.mapping.OneToMany;
import org.hibernate.mapping.OneToOne;
import org.hibernate.mapping.PersistentClass;
-import org.hibernate.mapping.PrimaryKey;
import org.hibernate.mapping.Property;
import org.hibernate.mapping.RootClass;
import org.hibernate.mapping.Selectable;
@@ -226,7 +225,7 @@
else if ( identifier instanceof SimpleValue ) {
SimpleValue simpleValue = (SimpleValue) identifier;
strategy = simpleValue.getIdentifierGeneratorStrategy();
- properties = simpleValue.getIdentifierGeneratorProperties();
+ properties = c2j.getFilteredIdentifierGeneratorProperties(simpleValue);
StringBuffer idResult = new StringBuffer();
AnnotationBuilder builder = AnnotationBuilder.createAnnotation( importType("javax.persistence.Id") );
idResult.append(builder.getResult());
Modified: tools/trunk/src/java/org/hibernate/tool/hbmlint/detector/SchemaByMetaDataDetector.java
===================================================================
--- tools/trunk/src/java/org/hibernate/tool/hbmlint/detector/SchemaByMetaDataDetector.java 2010-10-15 15:28:00 UTC (rev 20852)
+++ tools/trunk/src/java/org/hibernate/tool/hbmlint/detector/SchemaByMetaDataDetector.java 2010-10-27 14:36:12 UTC (rev 20853)
@@ -227,6 +227,7 @@
IdentifierGenerator ig = pc.getIdentifier()
.createIdentifierGenerator(
+ cfg.getIdentifierGeneratorFactory(),
dialect,
defaultCatalog,
defaultSchema,
@@ -248,6 +249,7 @@
IdentifierGenerator ig = ( (IdentifierCollection) collection ).getIdentifier()
.createIdentifierGenerator(
+ getConfiguration().getIdentifierGeneratorFactory(),
dialect,
defaultCatalog,
defaultSchema,
Modified: tools/trunk/src/test/org/hibernate/tool/hbm2x/Hbm2EJBDaoTest.java
===================================================================
--- tools/trunk/src/test/org/hibernate/tool/hbm2x/Hbm2EJBDaoTest.java 2010-10-15 15:28:00 UTC (rev 20852)
+++ tools/trunk/src/test/org/hibernate/tool/hbm2x/Hbm2EJBDaoTest.java 2010-10-27 14:36:12 UTC (rev 20853)
@@ -48,7 +48,7 @@
ArrayList list = new ArrayList();
List jars = new ArrayList();
jars.add("commons-logging-1.0.4.jar");
- jars.add("ejb3-persistence.jar");
+ jars.add("hibernate-jpa-2.0-api-1.0.0.Final.jar");
jars.add("jboss-ejb3x.jar");
TestHelper.compile(getOutputDir(), file, TestHelper.visitAllFiles(getOutputDir(), list), "1.5", TestHelper.buildClasspath(jars) );
Modified: tools/trunk/src/test/org/hibernate/tool/hbm2x/Hbm2JavaEjb3Test.java
===================================================================
--- tools/trunk/src/test/org/hibernate/tool/hbm2x/Hbm2JavaEjb3Test.java 2010-10-15 15:28:00 UTC (rev 20852)
+++ tools/trunk/src/test/org/hibernate/tool/hbm2x/Hbm2JavaEjb3Test.java 2010-10-27 14:36:12 UTC (rev 20853)
@@ -75,8 +75,8 @@
ArrayList list = new ArrayList();
List jars = new ArrayList();
- jars.add("ejb3-persistence.jar");
- jars.add("hibernate-annotations.jar");
+ jars.add("hibernate-jpa-2.0-api-1.0.0.Final.jar");
+ jars.add("hibernate3.jar");
TestHelper.compile(getOutputDir(), file, TestHelper.visitAllFiles(getOutputDir(), list), "1.5", TestHelper.buildClasspath(jars));
TestHelper.deleteDir(file);
Modified: tools/trunk/src/test/org/hibernate/tool/hbm2x/JdbcHbm2JavaEjb3Test.java
===================================================================
--- tools/trunk/src/test/org/hibernate/tool/hbm2x/JdbcHbm2JavaEjb3Test.java 2010-10-15 15:28:00 UTC (rev 20852)
+++ tools/trunk/src/test/org/hibernate/tool/hbm2x/JdbcHbm2JavaEjb3Test.java 2010-10-27 14:36:12 UTC (rev 20853)
@@ -45,8 +45,7 @@
ArrayList list = new ArrayList();
List jars = new ArrayList();
- jars.add("ejb3-persistence.jar");
- jars.add("hibernate-annotations.jar");
+ jars.add("hibernate-jpa-2.0-api-1.0.0.Final.jar");
TestHelper.compile(getOutputDir(), file, TestHelper.visitAllFiles(getOutputDir(), list), "1.5", TestHelper.buildClasspath(jars));
TestHelper.deleteDir(file);
Modified: tools/trunk/src/test/org/hibernate/tool/test/jdbc2cfg/OneToOneTest.java
===================================================================
--- tools/trunk/src/test/org/hibernate/tool/test/jdbc2cfg/OneToOneTest.java 2010-10-15 15:28:00 UTC (rev 20852)
+++ tools/trunk/src/test/org/hibernate/tool/test/jdbc2cfg/OneToOneTest.java 2010-10-27 14:36:12 UTC (rev 20853)
@@ -200,7 +200,7 @@
ArrayList list = new ArrayList();
List jars = new ArrayList();
- addAnnotationJars(jars);
+ //addAnnotationJars(jars);
TestHelper.compile(
getOutputDir(), getOutputDir(), TestHelper.visitAllFiles( getOutputDir(), list ), "1.5",
TestHelper.buildClasspath( jars )
@@ -248,7 +248,11 @@
assertEquals(9, getOutputDir().listFiles().length);
ArrayList list = new ArrayList();
List jars = new ArrayList();
- addAnnotationJars(jars);
+
+
+ jars.add( "hibernate3.jar" );
+ jars.add( "hibernate-jpa-2.0-api-1.0.0.Final.jar");
+
TestHelper.compile(
getOutputDir(), getOutputDir(), TestHelper.visitAllFiles( getOutputDir(), list ), "1.5",
TestHelper.buildClasspath( jars )
@@ -285,17 +289,7 @@
}
}
-
- private void addAnnotationJars(List jars) {
- jars.add( "ejb3-persistence.jar" );
- jars.add( "hibernate-annotations.jar" );
- jars.add( "hibernate-commons-annotations.jar" );
- jars.add( "hibernate3.jar" );
- jars.add( "dom4j-1.6.1.jar" );
- jars.add( "commons-logging-1.0.4.jar" );
-
- }
-
+
private void assertPropertyNotExist(PersistentClass projectClass, String prop) {
try {
projectClass.getProperty(prop);
Modified: tools/trunk/src/test/org/hibernate/tool/test/jdbc2cfg/PerformanceTest.java
===================================================================
--- tools/trunk/src/test/org/hibernate/tool/test/jdbc2cfg/PerformanceTest.java 2010-10-15 15:28:00 UTC (rev 20852)
+++ tools/trunk/src/test/org/hibernate/tool/test/jdbc2cfg/PerformanceTest.java 2010-10-27 14:36:12 UTC (rev 20853)
@@ -14,6 +14,7 @@
import org.hibernate.MappingException;
import org.hibernate.dialect.Dialect;
import org.hibernate.engine.Mapping;
+import org.hibernate.id.factory.IdentifierGeneratorFactory;
import org.hibernate.mapping.Column;
import org.hibernate.mapping.ForeignKey;
import org.hibernate.mapping.PrimaryKey;
@@ -62,6 +63,10 @@
public Type getReferencedPropertyType(String className, String propertyName) throws MappingException {
return null;
}
+
+ public IdentifierGeneratorFactory getIdentifierGeneratorFactory() {
+ return null;
+ }
};