Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Hibernate 3.6 #16

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.xml
Expand Up @@ -26,7 +26,7 @@
<pathelement location="etc"/>
<pathelement location="lib/testlibs/org.eclipse.jdt.core_3.1.0.jar"/>
<!-- remove hibernate-annotations.jar when migrating to maven -->
<pathelement location="lib/testlibs/hibernate-jpa-2.0-api-1.0.0.Final.jar"/>
<pathelement location="lib/testlibs/hibernate-jpa-2.0-api-1.0.1.Final.jar"/>
<pathelement location="${jdbc.driver.jar}"/>
<path refid="testsrc.path"/>
<pathelement location="${java.home}\..\lib\tools.jar"/>
Expand Down
Binary file removed lib/testlibs/commons-collections-2.1.1.jar
Binary file not shown.
Binary file added lib/testlibs/commons-collections-3.1.jar
Binary file not shown.
Binary file removed lib/testlibs/hibernate-jpa-2.0-api-1.0.0.Final.jar
Binary file not shown.
Binary file not shown.
Binary file modified lib/testlibs/hibernate3.jar
Binary file not shown.
Binary file modified lib/testlibs/javassist.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions lib/testlibs/version.properties
Expand Up @@ -70,8 +70,8 @@ asm-attrs.lib=asm-attrs.jar
asm-attrs.name=ASM bytecode library
asm-attrs.when=runtime, required if using 'cglib' bytecode provider

commons-collections.lib=commons-collections-2.1.1.jar
commons-collections.version=2.1.1
commons-collections.lib=commons-collections-3.1.jar
commons-collections.version=3.1
commons-collections.name=Commons Collections
commons-collections.when=runtime, required

Expand Down
20 changes: 10 additions & 10 deletions pom.xml
Expand Up @@ -11,7 +11,7 @@

<groupId>org.hibernate</groupId>
<artifactId>hibernate-tools</artifactId>
<version>3.5.0.Alpha-SNAPSHOT</version>
<version>3.6.0</version>
<packaging>jar</packaging>

<name>Hibernate Tools</name>
Expand Down Expand Up @@ -51,8 +51,8 @@
</developers>

<properties>
<hibernateversion>3.5.6-Final</hibernateversion>
<hibernateJpaversion>1.0.0.Final</hibernateJpaversion>
<hibernateversion>3.6.9.Final</hibernateversion>
<hibernateJpaversion>1.0.1.Final</hibernateJpaversion>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<!-- Default settings for Database connection; to be overridden in db specific profiles -->
Expand Down Expand Up @@ -80,12 +80,6 @@
<version>${hibernateversion}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>${hibernateversion}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
Expand Down Expand Up @@ -116,6 +110,12 @@
<version>2.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.12.0.GA</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand All @@ -137,7 +137,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.5.8</version>
<version>1.6.1</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
@@ -1,6 +1,6 @@
Hibernate Tools
===============
Version: 3.4.0.CR1, February 2011
Version: 3.6.0, February 2012

What is it
----------
Expand Down
18 changes: 9 additions & 9 deletions src/java/org/hibernate/cfg/JDBCBinder.java
Expand Up @@ -260,7 +260,7 @@ private Property bindOneToOne(PersistentClass rc, Table targetTable,
ForeignKey fk, Set processedColumns, boolean constrained, boolean inverseProperty) {


OneToOne value = new OneToOne(targetTable, rc);
OneToOne value = new OneToOne(mappings, targetTable, rc);
value.setReferencedEntityName(revengStrategy
.tableToClassName(TableIdentifier.create(targetTable)));

Expand Down Expand Up @@ -309,7 +309,7 @@ private Property bindOneToOne(PersistentClass rc, Table targetTable,
* @param propName
*/
private Property bindManyToOne(String propertyName, boolean mutable, Table table, ForeignKey fk, Set processedColumns) {
ManyToOne value = new ManyToOne(table);
ManyToOne value = new ManyToOne(mappings, table);
value.setReferencedEntityName( fk.getReferencedEntityName() );
Iterator columns = fk.getColumnIterator();
while ( columns.hasNext() ) {
Expand Down Expand Up @@ -407,7 +407,7 @@ private Property bindOneToMany(PersistentClass rc, ForeignKey foreignKey, Set pr

Table collectionTable = foreignKey.getTable();

Collection collection = new org.hibernate.mapping.Set(rc); // MASTER TODO: allow overriding collection type
Collection collection = new org.hibernate.mapping.Set(mappings, rc); // MASTER TODO: allow overriding collection type

collection.setCollectionTable(collectionTable); // CHILD+

Expand All @@ -423,7 +423,7 @@ private Property bindOneToMany(PersistentClass rc, ForeignKey foreignKey, Set pr

if(manyToMany) {

ManyToOne element = new ManyToOne( collection.getCollectionTable() );
ManyToOne element = new ManyToOne(mappings, collection.getCollectionTable());
//TODO: find the other foreignkey and choose the other side.
Iterator foreignKeyIterator = foreignKey.getTable().getForeignKeyIterator();
List keys = new ArrayList();
Expand All @@ -449,7 +449,7 @@ private Property bindOneToMany(PersistentClass rc, ForeignKey foreignKey, Set pr
} else {
String tableToClassName = bindCollection( rc, foreignKey, null, collection );

OneToMany oneToMany = new OneToMany( collection.getOwner() );
OneToMany oneToMany = new OneToMany(mappings, collection.getOwner());

oneToMany.setReferencedEntityName( tableToClassName ); // Child
mappings.addSecondPass( new JDBCCollectionSecondPass(mappings, collection) );
Expand All @@ -468,7 +468,7 @@ private Property bindOneToMany(PersistentClass rc, ForeignKey foreignKey, Set pr
.getValue();
}

SimpleValue keyValue = new DependantValue( collectionTable, referencedKeyValue );
SimpleValue keyValue = new DependantValue(mappings, collectionTable, referencedKeyValue);
//keyValue.setForeignKeyName("none"); // Avoid creating the foreignkey
//key.setCascadeDeleteEnabled( "cascade".equals( subnode.attributeValue("on-delete") ) );
Iterator columnIterator = foreignKey.getColumnIterator();
Expand Down Expand Up @@ -777,7 +777,7 @@ private Property bindBasicProperty(String propertyName, Table table, Column colu
}

private SimpleValue bindColumnToSimpleValue(Table table, Column column, Mapping mapping, boolean generatedIdentifier) {
SimpleValue value = new SimpleValue(table);
SimpleValue value = new SimpleValue(mappings, table);
value.addColumn(column);
value.setTypeName(guessAndAlignType(table, column, mapping, generatedIdentifier));
return value;
Expand Down Expand Up @@ -825,7 +825,7 @@ private String guessAndAlignType(Table table, Column column, Mapping mapping, bo
column.getLength(), column.getPrecision(), column.getScale(), column.isNullable(), generatedIdentifier
);

Type wantedType = TypeFactory.heuristicType(preferredHibernateType);
Type wantedType = mappings.getTypeResolver().heuristicType(preferredHibernateType);

if(wantedType!=null) {
int[] wantedSqlTypes = wantedType.sqlTypes(mapping);
Expand Down Expand Up @@ -865,7 +865,7 @@ private String typeCodeName(int sqlTypeCode) {
* @return
*/
private SimpleValue handleCompositeKey(RootClass rc, Set processedColumns, List keyColumns, Mapping mapping) {
Component pkc = new Component(rc);
Component pkc = new Component(mappings, rc);
pkc.setMetaAttributes(Collections.EMPTY_MAP);
pkc.setEmbedded(false);

Expand Down
9 changes: 5 additions & 4 deletions src/java/org/hibernate/cfg/JDBCMetaDataConfiguration.java
Expand Up @@ -93,16 +93,17 @@ public boolean preferBasicCompositeIds() {
public void setPreferBasicCompositeIds(boolean flag) {
preferBasicCompositeIds = flag;
}

protected void parseMappingElement(Element subelement, String name) {
if(!ignoreconfigxmlmapppings ) {
super.parseMappingElement(subelement, name);
if(!ignoreconfigxmlmapppings ) {
//FIXME the method is private
// super.parseMappingElement(subelement, name);
}
else {
log.info("Ignoring " + name + " mapping");
}
}

public void setReverseEngineeringStrategy(ReverseEngineeringStrategy reverseEngineeringStrategy) {
this.revEngStrategy = reverseEngineeringStrategy;
}
Expand Down
2 changes: 1 addition & 1 deletion src/java/org/hibernate/tool/Version.java
Expand Up @@ -5,7 +5,7 @@

final public class Version {

public static final String VERSION = "3.4.0.CR1";
public static final String VERSION = "3.6.0";

private static final Version instance = new Version();

Expand Down
4 changes: 2 additions & 2 deletions src/java/org/hibernate/tool/hbm2x/Cfg2JavaTool.java
Expand Up @@ -36,7 +36,7 @@
import org.hibernate.tool.hbm2x.visitor.JavaTypeFromValueVisitor;
import org.hibernate.type.PrimitiveType;
import org.hibernate.type.Type;
import org.hibernate.type.TypeFactory;
import org.hibernate.type.TypeResolver;
import org.hibernate.util.StringHelper;

/**
Expand Down Expand Up @@ -373,7 +373,7 @@ public String asFinderArgumentList(Map parameterTypes, ImportContext ctx) {
Type type = null;
if(entry.getValue() instanceof String) {
try {
type = TypeFactory.heuristicType((String) entry.getValue());
type = new TypeResolver().heuristicType((String) entry.getValue());
} catch(Throwable t) {
type = null;
typename = (String) entry.getValue();
Expand Down
Expand Up @@ -75,7 +75,7 @@ public void doStart() throws ExporterException {
pw.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<!DOCTYPE hibernate-configuration PUBLIC\r\n" +
" \"-//Hibernate/Hibernate Configuration DTD 3.0//EN\"\r\n" +
" \"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd\">\r\n" +
" \"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd\">\r\n" +
"<hibernate-configuration>");

boolean ejb3 = Boolean.valueOf((String)getProperties().get("ejb3")).booleanValue();
Expand Down
2 changes: 1 addition & 1 deletion src/templates/hbm/generalhbm.hbm.ftl
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
<!--
Expand Down
2 changes: 1 addition & 1 deletion src/templates/hbm/hibernate-mapping.hbm.ftl
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<!-- Generated ${date} by Hibernate Tools ${version} -->
<#if hmgs?exists && hmgs.hasNonDefaultSettings()>
Expand Down
2 changes: 1 addition & 1 deletion src/test/org/hibernate/tool/ant/TopDown.hbm.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping>

<class name="org.hibernate.tool.hbm2x.ant.TopDown">
Expand Down
2 changes: 1 addition & 1 deletion src/test/org/hibernate/tool/hbm2x/Article.hbm.xml
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<!--

Expand Down
2 changes: 1 addition & 1 deletion src/test/org/hibernate/tool/hbm2x/Author.hbm.xml
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<!--

Expand Down
2 changes: 1 addition & 1 deletion src/test/org/hibernate/tool/hbm2x/Bungalow.hbm.xml
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<!-- to test non EJB3 generator in EJB3 -->
<hibernate-mapping package="org.hibernate.tool.hbm2x">
Expand Down
2 changes: 1 addition & 1 deletion src/test/org/hibernate/tool/hbm2x/Constructors.hbm.xml
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<!--

Expand Down
2 changes: 1 addition & 1 deletion src/test/org/hibernate/tool/hbm2x/Customer.hbm.xml
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<!--

Expand Down
2 changes: 1 addition & 1 deletion src/test/org/hibernate/tool/hbm2x/DependentValue.hbm.xml
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping>

<!-- Mapping for dependentValue bug - HBX-953 -->
Expand Down
2 changes: 1 addition & 1 deletion src/test/org/hibernate/tool/hbm2x/GenericModel.hbm.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="org.hibernate.tool.hbm2x">

Expand Down
2 changes: 1 addition & 1 deletion src/test/org/hibernate/tool/hbm2x/HashEquals.hbm.xml
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<!--

Expand Down
2 changes: 1 addition & 1 deletion src/test/org/hibernate/tool/hbm2x/Hbm2EJBDaoTest.java
Expand Up @@ -48,7 +48,7 @@ public void testCompilable() throws IOException {
ArrayList list = new ArrayList();
List jars = new ArrayList();
jars.add("commons-logging-1.0.4.jar");
jars.add("hibernate-jpa-2.0-api-1.0.0.Final.jar");
jars.add("hibernate-jpa-2.0-api-1.0.1.Final.jar");
jars.add("jboss-ejb3x.jar");
TestHelper.compile(getOutputDir(), file, TestHelper.visitAllFiles(getOutputDir(), list), "1.5", TestHelper.buildClasspath(jars) );

Expand Down
2 changes: 1 addition & 1 deletion src/test/org/hibernate/tool/hbm2x/Hbm2JavaEjb3Test.java
Expand Up @@ -75,7 +75,7 @@ public void testCompile() {

ArrayList list = new ArrayList();
List jars = new ArrayList();
jars.add("hibernate-jpa-2.0-api-1.0.0.Final.jar");
jars.add("hibernate-jpa-2.0-api-1.0.1.Final.jar");
jars.add("hibernate3.jar");
TestHelper.compile(getOutputDir(), file, TestHelper.visitAllFiles(getOutputDir(), list), "1.5", TestHelper.buildClasspath(jars));

Expand Down
2 changes: 1 addition & 1 deletion src/test/org/hibernate/tool/hbm2x/HelloWorld.hbm.xml
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<!--

Expand Down
Expand Up @@ -45,7 +45,7 @@ public void testCompile() {

ArrayList list = new ArrayList();
List jars = new ArrayList();
jars.add("hibernate-jpa-2.0-api-1.0.0.Final.jar");
jars.add("hibernate-jpa-2.0-api-1.0.1.Final.jar");
TestHelper.compile(getOutputDir(), file, TestHelper.visitAllFiles(getOutputDir(), list), "1.5", TestHelper.buildClasspath(jars));

TestHelper.deleteDir(file);
Expand Down
2 changes: 1 addition & 1 deletion src/test/org/hibernate/tool/hbm2x/LineItem.hbm.xml
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<!--

Expand Down
2 changes: 1 addition & 1 deletion src/test/org/hibernate/tool/hbm2x/Order.hbm.xml
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="org.hibernate.tool.hbm2x">
<!--
Expand Down
2 changes: 1 addition & 1 deletion src/test/org/hibernate/tool/hbm2x/Passenger.hbm.xml
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="org.hibernate.tool.hbm2x">

Expand Down
2 changes: 1 addition & 1 deletion src/test/org/hibernate/tool/hbm2x/Product.hbm.xml
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="org.hibernate.tool.hbm2x">

Expand Down