Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From f8d97ea71200895dd8d7b2a9dddac7f998ec8b7b Mon Sep 17 00:00:00 2001
- From: Petr Stastny <p.stastny@gmx.de>
- Date: Mon, 4 Mar 2013 15:51:06 +0100
- Subject: [PATCH] Update Hibernate Plugin for Hibernate 4.x
- ---
- sql12/fw/pom.xml | 13 ++
- .../squirrel_sql/fw/dialects/TeiidDialect.java | 172 +++++++++++---------
- .../WikiTableConfigurationFactoryTest.java | 1 -
- sql12/installer/pom.xml | 6 +-
- .../server/HibernateServerConnectionImpl.java | 61 ++++---
- 5 files changed, 152 insertions(+), 101 deletions(-)
- diff --git a/sql12/fw/pom.xml b/sql12/fw/pom.xml
- index 2a7fdf6..a57656d 100644
- --- a/sql12/fw/pom.xml
- +++ b/sql12/fw/pom.xml
- @@ -114,6 +114,18 @@
- <version>1.6.1</version>
- </dependency>
- <dependency>
- + <groupId>org.hibernate</groupId>
- + <artifactId>hibernate-core</artifactId>
- + <version>4.1.9.Final</version>
- + <exclusions>
- + <exclusion>
- + <groupId>javax.transaction</groupId>
- + <artifactId>jta</artifactId>
- + </exclusion>
- + </exclusions>
- + </dependency>
- + <!--
- + <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-annotations</artifactId>
- <version>${hibernate-annotations-version}</version>
- @@ -140,6 +152,7 @@
- </exclusions>
- </dependency>
- + -->
- <dependency>
- <groupId>net.sourceforge.jexcelapi</groupId>
- <artifactId>jxl</artifactId>
- diff --git a/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/dialects/TeiidDialect.java b/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/dialects/TeiidDialect.java
- index 0bf20aa..2b8e6ec 100644
- --- a/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/dialects/TeiidDialect.java
- +++ b/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/dialects/TeiidDialect.java
- @@ -27,12 +27,26 @@ import java.sql.ResultSet;
- import java.sql.SQLException;
- import java.sql.Types;
- -import org.hibernate.Hibernate;
- import org.hibernate.LockMode;
- import org.hibernate.dialect.Dialect;
- import org.hibernate.dialect.function.NoArgSQLFunction;
- import org.hibernate.dialect.function.StandardSQLFunction;
- import org.hibernate.dialect.function.VarArgsSQLFunction;
- +import org.hibernate.type.BigDecimalType;
- +import org.hibernate.type.BigIntegerType;
- +import org.hibernate.type.BlobType;
- +import org.hibernate.type.CharacterType;
- +import org.hibernate.type.ClobType;
- +import org.hibernate.type.DateType;
- +import org.hibernate.type.DoubleType;
- +import org.hibernate.type.FloatType;
- +import org.hibernate.type.IntegerType;
- +import org.hibernate.type.LongType;
- +import org.hibernate.type.ObjectType;
- +
- +import org.hibernate.type.StringType;
- +import org.hibernate.type.TimeType;
- +import org.hibernate.type.TimestampType;
- /**
- * This class was temporarily re-packaged and will remain so until it deployed to
- @@ -67,94 +81,94 @@ public class TeiidDialect extends Dialect {
- registerColumnType(Types.CLOB, "clob"); //$NON-NLS-1$
- registerColumnType(Types.JAVA_OBJECT, "object"); //$NON-NLS-1$
- - registerFunction("acos", new StandardSQLFunction("acos", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("asin", new StandardSQLFunction("asin", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("atan", new StandardSQLFunction("atan", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("atan2", new StandardSQLFunction("atan2", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("acos", new StandardSQLFunction("acos", DoubleType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("asin", new StandardSQLFunction("asin", DoubleType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("atan", new StandardSQLFunction("atan", DoubleType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("atan2", new StandardSQLFunction("atan2", DoubleType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- registerFunction("ceil", new StandardSQLFunction("ceiling")); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("cos", new StandardSQLFunction("cos", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("cot", new StandardSQLFunction("cot", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("degrees", new StandardSQLFunction("degrees", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("exp", new StandardSQLFunction("exp", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("cos", new StandardSQLFunction("cos", DoubleType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("cot", new StandardSQLFunction("cot", DoubleType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("degrees", new StandardSQLFunction("degrees", DoubleType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("exp", new StandardSQLFunction("exp", DoubleType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- registerFunction("floor", new StandardSQLFunction("floor")); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("formatbigdecimal", new StandardSQLFunction("formatbigdecimal", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("formatbiginteger", new StandardSQLFunction("formatbiginteger", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("formatdouble", new StandardSQLFunction("formatdouble", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("formatfloat", new StandardSQLFunction("formatfloat", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("formatinteger", new StandardSQLFunction("formatinteger", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("formatlong", new StandardSQLFunction("formatlong", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("log", new StandardSQLFunction("log", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("formatbigdecimal", new StandardSQLFunction("formatbigdecimal", StringType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("formatbiginteger", new StandardSQLFunction("formatbiginteger", StringType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("formatdouble", new StandardSQLFunction("formatdouble", StringType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("formatfloat", new StandardSQLFunction("formatfloat", StringType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("formatinteger", new StandardSQLFunction("formatinteger", StringType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("formatlong", new StandardSQLFunction("formatlong", StringType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("log", new StandardSQLFunction("log", DoubleType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- registerFunction("mod", new StandardSQLFunction("mod")); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("parsebigdecimal", new StandardSQLFunction("parsebigdecimal", Hibernate.BIG_DECIMAL)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("parsebiginteger", new StandardSQLFunction("parsebiginteger", Hibernate.BIG_INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("parsedouble", new StandardSQLFunction("parsedouble", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("parsefloat", new StandardSQLFunction("parsefloat", Hibernate.FLOAT)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("parseinteger", new StandardSQLFunction("parseinteger", Hibernate.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("parselong", new StandardSQLFunction("parselong", Hibernate.LONG)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("pi", new StandardSQLFunction("pi", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("power", new StandardSQLFunction("power", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("radians", new StandardSQLFunction("radians", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("parsebigdecimal", new StandardSQLFunction("parsebigdecimal", BigDecimalType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("parsebiginteger", new StandardSQLFunction("parsebiginteger", BigIntegerType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("parsedouble", new StandardSQLFunction("parsedouble", DoubleType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("parsefloat", new StandardSQLFunction("parsefloat", FloatType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("parseinteger", new StandardSQLFunction("parseinteger", IntegerType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("parselong", new StandardSQLFunction("parselong", LongType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("pi", new StandardSQLFunction("pi", DoubleType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("power", new StandardSQLFunction("power", DoubleType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("radians", new StandardSQLFunction("radians", DoubleType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- registerFunction("round", new StandardSQLFunction("round")); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("sign", new StandardSQLFunction("sign", Hibernate.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("sin", new StandardSQLFunction("sin", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("tan", new StandardSQLFunction("tan", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
- -
- - registerFunction("ascii", new StandardSQLFunction("ascii", Hibernate.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("chr", new StandardSQLFunction("chr", Hibernate.CHARACTER)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("char", new StandardSQLFunction("char", Hibernate.CHARACTER)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("concat", new VarArgsSQLFunction(Hibernate.STRING, "", "||", "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- - registerFunction("initcap", new StandardSQLFunction("initcap", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("insert", new StandardSQLFunction("insert", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("lcase", new StandardSQLFunction("lcase", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("left", new StandardSQLFunction("left", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("locate", new StandardSQLFunction("locate", Hibernate.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("lpad", new StandardSQLFunction("lpad", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("ltrim", new StandardSQLFunction("ltrim", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("repeat", new StandardSQLFunction("repeat", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("replace", new StandardSQLFunction("replace", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("right", new StandardSQLFunction("right", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("rpad", new StandardSQLFunction("rpad", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("rtrim", new StandardSQLFunction("rtrim", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("substring", new StandardSQLFunction("substring", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("translate", new StandardSQLFunction("translate", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("ucase", new StandardSQLFunction("ucase", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
- -
- - registerFunction("curdate", new NoArgSQLFunction("curdate", Hibernate.DATE)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("curtime", new NoArgSQLFunction("curtime", Hibernate.TIME)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("now", new NoArgSQLFunction("now", Hibernate.TIMESTAMP)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("dayname", new StandardSQLFunction("dayname", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("dayofmonth", new StandardSQLFunction("dayofmonth", Hibernate.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("dayofweek", new StandardSQLFunction("dayofweek", Hibernate.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("dayofyear", new StandardSQLFunction("dayofyear", Hibernate.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("formatdate", new StandardSQLFunction("formatdate", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("formattime", new StandardSQLFunction("formattime", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("formattimestamp", new StandardSQLFunction("formattimestamp", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("hour", new StandardSQLFunction("hour", Hibernate.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("minute", new StandardSQLFunction("minute", Hibernate.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("monthname", new StandardSQLFunction("monthname", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("parsedate", new StandardSQLFunction("parsedate", Hibernate.DATE)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("parsetime", new StandardSQLFunction("parsetime", Hibernate.TIME)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("parsetimestamp", new StandardSQLFunction("parsetimestamp", Hibernate.TIMESTAMP)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("second", new StandardSQLFunction("second", Hibernate.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("timestampcreate", new StandardSQLFunction("timestampcreate", Hibernate.TIMESTAMP)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("sign", new StandardSQLFunction("sign", IntegerType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("sin", new StandardSQLFunction("sin", DoubleType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("tan", new StandardSQLFunction("tan", DoubleType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- +
- + registerFunction("ascii", new StandardSQLFunction("ascii", IntegerType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("chr", new StandardSQLFunction("chr", CharacterType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("char", new StandardSQLFunction("char", CharacterType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("concat", new VarArgsSQLFunction(StringType.INSTANCE, "", "||", "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- + registerFunction("initcap", new StandardSQLFunction("initcap", StringType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("insert", new StandardSQLFunction("insert", StringType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("lcase", new StandardSQLFunction("lcase", StringType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("left", new StandardSQLFunction("left", StringType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("locate", new StandardSQLFunction("locate", IntegerType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("lpad", new StandardSQLFunction("lpad", StringType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("ltrim", new StandardSQLFunction("ltrim", StringType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("repeat", new StandardSQLFunction("repeat", StringType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("replace", new StandardSQLFunction("replace", StringType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("right", new StandardSQLFunction("right", StringType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("rpad", new StandardSQLFunction("rpad", StringType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("rtrim", new StandardSQLFunction("rtrim", StringType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("substring", new StandardSQLFunction("substring", StringType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("translate", new StandardSQLFunction("translate", StringType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("ucase", new StandardSQLFunction("ucase", StringType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- +
- + registerFunction("curdate", new NoArgSQLFunction("curdate", DateType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("curtime", new NoArgSQLFunction("curtime", TimeType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("now", new NoArgSQLFunction("now", TimestampType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("dayname", new StandardSQLFunction("dayname", StringType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("dayofmonth", new StandardSQLFunction("dayofmonth", IntegerType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("dayofweek", new StandardSQLFunction("dayofweek", IntegerType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("dayofyear", new StandardSQLFunction("dayofyear", IntegerType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("formatdate", new StandardSQLFunction("formatdate", StringType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("formattime", new StandardSQLFunction("formattime", StringType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("formattimestamp", new StandardSQLFunction("formattimestamp", StringType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("hour", new StandardSQLFunction("hour", IntegerType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("minute", new StandardSQLFunction("minute", IntegerType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("monthname", new StandardSQLFunction("monthname", StringType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("parsedate", new StandardSQLFunction("parsedate", DateType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("parsetime", new StandardSQLFunction("parsetime", TimeType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("parsetimestamp", new StandardSQLFunction("parsetimestamp", TimestampType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("second", new StandardSQLFunction("second", IntegerType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("timestampcreate", new StandardSQLFunction("timestampcreate", TimestampType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- registerFunction("timestampAdd", new StandardSQLFunction("timestampAdd")); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("timestampDiff", new StandardSQLFunction("timestampDiff", Hibernate.LONG)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("week", new StandardSQLFunction("week", Hibernate.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("year", new StandardSQLFunction("year", Hibernate.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("modifytimezone", new StandardSQLFunction("modifytimezone", Hibernate.TIMESTAMP)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("timestampDiff", new StandardSQLFunction("timestampDiff", LongType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("week", new StandardSQLFunction("week", IntegerType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("year", new StandardSQLFunction("year", IntegerType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("modifytimezone", new StandardSQLFunction("modifytimezone", TimestampType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- registerFunction("convert", new StandardSQLFunction("convert")); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("to_bytes", new StandardSQLFunction("to_bytes", Hibernate.BLOB)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("to_chars", new StandardSQLFunction("to_chars", Hibernate.CLOB)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("from_unittime", new StandardSQLFunction("from_unittime", Hibernate.TIMESTAMP)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("session_id", new StandardSQLFunction("session_id", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("to_bytes", new StandardSQLFunction("to_bytes", BlobType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("to_chars", new StandardSQLFunction("to_chars", ClobType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("from_unittime", new StandardSQLFunction("from_unittime",TimestampType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("session_id", new StandardSQLFunction("session_id", StringType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("uuid", new StandardSQLFunction("uuid", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("unescape", new StandardSQLFunction("unescape", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("uuid", new StandardSQLFunction("uuid", StringType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("unescape", new StandardSQLFunction("unescape", StringType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("array_get", new StandardSQLFunction("uuid", Hibernate.OBJECT)); //$NON-NLS-1$ //$NON-NLS-2$
- - registerFunction("array_length", new StandardSQLFunction("unescape", Hibernate.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("array_get", new StandardSQLFunction("uuid", ObjectType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- + registerFunction("array_length", new StandardSQLFunction("unescape", IntegerType.INSTANCE)); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public boolean dropConstraints() {
- diff --git a/sql12/fw/src/test/java/net/sourceforge/squirrel_sql/fw/gui/action/wikiTable/WikiTableConfigurationFactoryTest.java b/sql12/fw/src/test/java/net/sourceforge/squirrel_sql/fw/gui/action/wikiTable/WikiTableConfigurationFactoryTest.java
- index fbdaf8f..446fa24 100644
- --- a/sql12/fw/src/test/java/net/sourceforge/squirrel_sql/fw/gui/action/wikiTable/WikiTableConfigurationFactoryTest.java
- +++ b/sql12/fw/src/test/java/net/sourceforge/squirrel_sql/fw/gui/action/wikiTable/WikiTableConfigurationFactoryTest.java
- @@ -26,7 +26,6 @@ import java.util.List;
- import net.sourceforge.squirrel_sql.BaseSQuirreLJUnit4TestCase;
- -import org.hibernate.validator.AssertTrue;
- import org.junit.Before;
- import org.junit.Test;
- diff --git a/sql12/installer/pom.xml b/sql12/installer/pom.xml
- index cc466f0..eeff727 100644
- --- a/sql12/installer/pom.xml
- +++ b/sql12/installer/pom.xml
- @@ -107,10 +107,14 @@
- <includedArtifact>commons-logging:commons-logging</includedArtifact>
- <includedArtifact>com.jgoodies:forms</includedArtifact>
- <includedArtifact>net.sf.squirrel-sql:fw</includedArtifact>
- +<!--
- <includedArtifact>org.hibernate:hibernate-annotations</includedArtifact>
- <includedArtifact>org.hibernate:hibernate-commons-annotations</includedArtifact>
- <includedArtifact>org.hibernate:hibernate-entitymanager</includedArtifact>
- - <includedArtifact>org.hibernate:hibernate</includedArtifact>
- +-->
- + <includedArtifact>org.jboss.logging:jboss-logging</includedArtifact>
- + <includedArtifact>org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec</includedArtifact>
- + <includedArtifact>org.hibernate:hibernate-core</includedArtifact>
- <includedArtifact>net.sourceforge.jexcelapi:jxl</includedArtifact>
- <includedArtifact>log4j:log4j</includedArtifact>
- <includedArtifact>be.cyberelf.nanoxml:nanoxml</includedArtifact>
- diff --git a/sql12/plugins/hibernate/src/main/java/net/sourceforge/squirrel_sql/plugins/hibernate/server/HibernateServerConnectionImpl.java b/sql12/plugins/hibernate/src/main/java/net/sourceforge/squirrel_sql/plugins/hibernate/server/HibernateServerConnectionImpl.java
- index ca5ef7b..33c39b7 100644
- --- a/sql12/plugins/hibernate/src/main/java/net/sourceforge/squirrel_sql/plugins/hibernate/server/HibernateServerConnectionImpl.java
- +++ b/sql12/plugins/hibernate/src/main/java/net/sourceforge/squirrel_sql/plugins/hibernate/server/HibernateServerConnectionImpl.java
- @@ -4,7 +4,15 @@ import java.rmi.RemoteException;
- import java.sql.Connection;
- import java.sql.DatabaseMetaData;
- import java.sql.SQLException;
- -import java.util.*;
- +import java.util.ArrayList;
- +import java.util.Collection;
- +import java.util.Collections;
- +import java.util.Date;
- +import java.util.HashMap;
- +import java.util.List;
- +import java.util.Map;
- +import java.util.Properties;
- +import java.util.TreeMap;
- public class HibernateServerConnectionImpl implements HibernateServerConnection
- {
- @@ -121,15 +129,14 @@ public class HibernateServerConnectionImpl implements HibernateServerConnection
- for (ReflectionCaller persister : persisters)
- {
- Object entityMode_POJO = persister.getClass("org.hibernate.EntityMode", _cl).getField("POJO").getCallee();
- - Class mappedClass = (Class) persister.callMethod("getMappedClass", new Object[]{entityMode_POJO}).getCallee();
- -
- + Class mappedClass = (Class) persister.callMethod("getMappedClass").getCallee();
- +
- String identifierPropertyName = (String) persister.callMethod("getIdentifierPropertyName").getCallee();
- Class identifierPropertyClass = persister.callMethod("getIdentifierType").callMethod("getReturnedClass").getCalleeClass();
- String identifierPropertyClassName = identifierPropertyClass.getName();
- -
- String tableName = (String) persister.callMethod("getTableName").getCallee();
- String[] identifierColumnNames = (String[]) persister.callMethod("getIdentifierColumnNames").getCallee();
- @@ -141,16 +148,28 @@ public class HibernateServerConnectionImpl implements HibernateServerConnection
- String[] propertyNames = (String[]) persister.callMethod("getPropertyNames").getCallee();
- -
- - HibernatePropertyInfo[] infos = new HibernatePropertyInfo[propertyNames.length];
- +
- + List<HibernatePropertyInfo> infoList = new ArrayList<HibernatePropertyInfo>();
- +
- for (int i = 0; i < propertyNames.length; i++)
- {
- ReflectionCaller propertyTypeCaller = persister.callMethod("getPropertyType", propertyNames[i]);
- String mayBeCollectionTypeName = propertyTypeCaller.callMethod("getReturnedClass").getCalleeClass().getName();
- String propTableName = (String) persister.callMethod("getPropertyTableName", propertyNames[i]).getCallee();
- +
- String[] propertyColumnNames = (String[]) persister.callMethod("getPropertyColumnNames", propertyNames[i]).getCallee();
- +
- + if (propertyColumnNames.length>1) {
- + // this should be ignored since a property having two columns is not a real property
- + // but denotes only a key spanning several properties
- + // properties declares that the contained properties form an alternate key. The name attribute allows
- + // an alternate key to be used as the target of a property-ref
- + continue;
- + }
- + HibernatePropertyInfo propertyInfo = null;
- +
- try
- {
- // If this isn't instanceof org.hibernate.type.CollectionType a NoSuchMethodException will be thrown
- @@ -158,15 +177,18 @@ public class HibernateServerConnectionImpl implements HibernateServerConnection
- ReflectionCaller collectionMetaDataCaller = sessionFactoryImplcaller.callMethod("getCollectionMetadata", role);
- String typeName = collectionMetaDataCaller.callMethod("getElementType").callMethod("getReturnedClass").getCalleeClass().getName();
- -
- - infos[i] = new HibernatePropertyInfo(propertyNames[i], typeName, propTableName, propertyColumnNames);
- - infos[i].setCollectionClassName(mayBeCollectionTypeName);
- +
- + propertyInfo = new HibernatePropertyInfo(propertyNames[i], typeName, propTableName, propertyColumnNames);
- + propertyInfo.setCollectionClassName(mayBeCollectionTypeName);
- + infoList.add(propertyInfo);
- +
- }
- catch(RuntimeException e)
- {
- if(HibernateServerExceptionUtil.getDeepestThrowable(e) instanceof NoSuchMethodException)
- {
- - infos[i] = new HibernatePropertyInfo(propertyNames[i], mayBeCollectionTypeName, propTableName, propertyColumnNames);
- + propertyInfo = new HibernatePropertyInfo(propertyNames[i], mayBeCollectionTypeName, propTableName, propertyColumnNames);
- + infoList.add(propertyInfo);
- }
- else
- {
- @@ -174,7 +196,8 @@ public class HibernateServerConnectionImpl implements HibernateServerConnection
- }
- }
- }
- - _infoDataByClassName.put(mappedClass.getName(), new MappedClassInfoData(mappedClass.getName(), tableName, identifierPropInfo, infos));
- + _infoDataByClassName.put(mappedClass.getName(),
- + new MappedClassInfoData(mappedClass.getName(), tableName, identifierPropInfo, infoList.toArray(new HibernatePropertyInfo[]{})));
- }
- }
- @@ -184,7 +207,7 @@ public class HibernateServerConnectionImpl implements HibernateServerConnection
- {
- try
- {
- - Connection con = (Connection) getRcHibernateSession().callMethod("getJDBCContext").callMethod("getConnectionManager").callMethod("getConnection").getCallee();
- + Connection con = (Connection) getRcHibernateSession().callMethod("getFactory").callMethod("getJdbcServices").callMethod("getConnectionProvider").callMethod("getConnection").getCallee();
- DatabaseMetaData md = con.getMetaData();
- return new HibernateSqlConnectionData(md.getURL(), md.getUserName(), md.getDriverName(), md.getDriverVersion());
- }
- @@ -298,6 +321,11 @@ public class HibernateServerConnectionImpl implements HibernateServerConnection
- tryRollbackTx(ret);
- }
- + if (null != queryResList)
- + {
- + ret.setQueryResultList(
- + new ObjectSubstituteFactory(_cl).replaceObjectsWithSubstitutes(queryResList, _infoDataByClassName));
- + }
- try
- {
- @@ -307,13 +335,6 @@ public class HibernateServerConnectionImpl implements HibernateServerConnection
- {
- ret.putSessionAdminException("Exception occurced during call of Session.clear()", prepareTransport(t));
- }
- -
- - if (null != queryResList)
- - {
- - ret.setQueryResultList(
- - new ObjectSubstituteFactory(_cl).replaceObjectsWithSubstitutes(queryResList, _infoDataByClassName));
- - }
- -
- return ret;
- }
- @@ -373,7 +394,7 @@ public class HibernateServerConnectionImpl implements HibernateServerConnection
- RCParam rcParam = new RCParam();
- rcParam.add(con.getCallee(), Connection.class);
- - _rcHibernateSession = new ReflectionCaller(_sessionFactoryImpl).callMethod("openSession", rcParam);
- + _rcHibernateSession = new ReflectionCaller(_sessionFactoryImpl).callMethod("openSession");
- }
- }
- --
- 1.7.10.4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement