Permalink
Browse files

HHH-7346 Tests fail on Postgresql due to failure in typecasts

  • Loading branch information...
1 parent 1f467c0 commit d92e91bb4d32a225eec7c728cc7ce52ccc0b1b7e @stliu stliu committed May 23, 2012
Showing with 47 additions and 28 deletions.
  1. +1 −1 databases/postgresql84/resources/hibernate.properties
  2. +6 −2 documentation/src/main/docbook/devguide/en-US/Database_Access.xml
  3. +1 −1 documentation/src/main/docbook/devguide/en-US/extras/hibernate.properties
  4. +14 −5 documentation/src/main/docbook/manual/en-US/content/configuration.xml
  5. +2 −1 hibernate-core/src/main/java/org/hibernate/criterion/IlikeExpression.java
  6. +1 −1 hibernate-core/src/matrix/java/org/hibernate/test/annotations/query/QueryAndSQLTest.java
  7. +1 −1 hibernate-core/src/matrix/java/org/hibernate/test/annotations/xml/ejb3/Ejb3XmlTest.java
  8. +1 −1 hibernate-core/src/matrix/java/org/hibernate/test/bidi/AuctionTest.java
  9. +2 −1 hibernate-core/src/matrix/java/org/hibernate/test/criteria/LikeTest.java
  10. +2 −1 hibernate-core/src/matrix/java/org/hibernate/test/formulajoin/FormulaJoinTest.java
  11. +4 −3 hibernate-core/src/matrix/java/org/hibernate/test/hql/ASTParserLoadingTest.java
  12. +3 −2 hibernate-core/src/matrix/java/org/hibernate/test/hql/HQLTest.java
  13. +1 −1 ...x/java/org/hibernate/test/inheritancediscriminator/PersistChildEntitiesWithDiscriminatorTest.java
  14. +1 −1 hibernate-core/src/matrix/java/org/hibernate/test/legacy/CustomSQLTest.java
  15. +3 −2 hibernate-core/src/matrix/java/org/hibernate/test/legacy/FooBarTest.java
  16. +1 −1 hibernate-core/src/matrix/java/org/hibernate/test/legacy/LegacyTestCase.java
  17. +1 −1 hibernate-core/src/matrix/java/org/hibernate/test/legacy/SQLLoaderTest.java
  18. +1 −1 hibernate-core/src/matrix/java/org/hibernate/test/tm/TransactionTimeoutTest.java
  19. +1 −1 hibernate-core/src/matrix/java/org/hibernate/test/typeoverride/TypeOverrideTest.java
@@ -22,7 +22,7 @@
# Boston, MA 02110-1301 USA
#
-hibernate.dialect org.hibernate.dialect.PostgreSQLDialect
+hibernate.dialect org.hibernate.dialect.PostgreSQL82Dialect
hibernate.connection.driver_class org.postgresql.Driver
hibernate.connection.url jdbc:postgresql://localhost/hibernate
hibernate.connection.username hibernate
@@ -343,9 +343,13 @@
<entry>org.hibernate.dialect.PointbaseDialect</entry>
</row>
<row>
- <entry>PostgreSQL</entry>
- <entry>org.hibernate.dialect.PostgreSQLDialect</entry>
+ <entry>PostgreSQL 8.1</entry>
+ <entry>org.hibernate.dialect.PostgreSQL81Dialect</entry>
</row>
+ <row>
+ <entry>PostgreSQL 8.2 and later</entry>
+ <entry>org.hibernate.dialect.PostgreSQL82Dialect</entry>
+ </row>
<row>
<entry>Progress</entry>
<entry>org.hibernate.dialect.ProgressDialect</entry>
@@ -6,4 +6,4 @@ hibernate.c3p0.min_size=5
hibernate.c3p0.max_size=20
hibernate.c3p0.timeout=1800
hibernate.c3p0.max_statements=50
-hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
+hibernate.dialect = org.hibernate.dialect.PostgreSQL82Dialect
@@ -206,7 +206,7 @@ hibernate.c3p0.min_size=5
hibernate.c3p0.max_size=20
hibernate.c3p0.timeout=1800
hibernate.c3p0.max_statements=50
-hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect</programlisting>
+hibernate.dialect = org.hibernate.dialect.PostgreSQL82Dialect</programlisting>
<para>For use inside an application server, you should almost always
configure Hibernate to obtain connections from an application server
@@ -275,7 +275,7 @@ hibernate.transaction.factory_class = \
org.hibernate.transaction.JTATransactionFactory
hibernate.transaction.manager_lookup_class = \
org.hibernate.transaction.JBossTransactionManagerLookup
-hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect</programlisting>
+hibernate.dialect = org.hibernate.dialect.PostgreSQL82Dialect</programlisting>
<para>JDBC connections obtained from a JNDI datasource will automatically
participate in the container-managed transactions of the application
@@ -975,11 +975,15 @@ hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect</programlisting>
</row>
<row>
- <entry>PostgreSQL</entry>
+ <entry>PostgreSQL 8.1</entry>
- <entry><literal>org.hibernate.dialect.PostgreSQLDialect</literal></entry>
+ <entry><literal>org.hibernate.dialect.PostgreSQL81Dialect</literal></entry>
</row>
+ <row>
+ <entry>PostgreSQL 8.2 and later</entry>
+ <entry><literal>org.hibernate.dialect.PostgreSQL82Dialect</literal></entry>
+ </row>
<row>
<entry>MySQL5</entry>
@@ -1023,11 +1027,16 @@ hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect</programlisting>
</row>
<row>
- <entry>Sybase</entry>
+ <entry>Sybase ASE 15.5</entry>
<entry><literal>org.hibernate.dialect.SybaseASE15Dialect</literal></entry>
</row>
+ <row>
+ <entry>Sybase ASE 15.7</entry>
+
+ <entry><literal>org.hibernate.dialect.SybaseASE157Dialect</literal></entry>
+ </row>
<row>
<entry>Sybase Anywhere</entry>
@@ -27,6 +27,7 @@
import org.hibernate.Criteria;
import org.hibernate.HibernateException;
import org.hibernate.dialect.Dialect;
+import org.hibernate.dialect.PostgreSQL81Dialect;
import org.hibernate.dialect.PostgreSQLDialect;
import org.hibernate.engine.spi.TypedValue;
@@ -57,7 +58,7 @@ public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery)
if ( columns.length != 1 ) {
throw new HibernateException( "ilike may only be used with single-column properties" );
}
- if ( dialect instanceof PostgreSQLDialect ) {
+ if ( dialect instanceof PostgreSQLDialect || dialect instanceof PostgreSQL81Dialect) {
return columns[0] + " ilike ?";
}
else {
@@ -354,7 +354,7 @@ public void testDiscriminator() throws Exception {
}
@Test
- @SkipForDialect(value = { PostgreSQL81Dialect.class },
+ @SkipForDialect(value = { PostgreSQL81Dialect.class, PostgreSQLDialect.class },
comment = "postgresql jdbc driver does not implement the setQueryTimeout method")
public void testCache() throws Exception {
Session s;
@@ -45,7 +45,7 @@
*/
public class Ejb3XmlTest extends BaseCoreFunctionalTestCase {
@Test
- @SkipForDialect(value = { PostgreSQL81Dialect.class },
+ @SkipForDialect(value = { PostgreSQL81Dialect.class, PostgreSQLDialect.class },
comment = "postgresql jdbc driver does not implement the setQueryTimeout method")
public void testEjb3Xml() throws Exception {
Session s = openSession();
@@ -49,7 +49,7 @@
@Test
@SuppressWarnings( {"unchecked"})
- @SkipForDialect( value = PostgreSQL81Dialect.class, comment = "doesn't like boolean=1" )
+ @SkipForDialect( value = {PostgreSQL81Dialect.class, PostgreSQLDialect.class}, comment = "doesn't like boolean=1" )
public void testLazy() {
Session s = openSession();
Transaction t = s.beginTransaction();
@@ -30,6 +30,7 @@
import org.hibernate.Transaction;
import org.hibernate.criterion.Restrictions;
import org.hibernate.dialect.MySQLDialect;
+import org.hibernate.dialect.PostgreSQL81Dialect;
import org.hibernate.dialect.PostgreSQLDialect;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
@@ -67,7 +68,7 @@ public void testLike(){
assertEquals( 1, objects.size() );
session.clear();
- if ( !( getDialect() instanceof MySQLDialect ) && ! ( getDialect() instanceof PostgreSQLDialect )) {
+ if ( !( getDialect() instanceof MySQLDialect ) && ! ( getDialect() instanceof PostgreSQLDialect ) && ! ( getDialect() instanceof PostgreSQL81Dialect )) {
// retrieve object - case insensitive via custom expression - works
// ok
objects = session.createCriteria( TestObject.class ).add(
@@ -28,6 +28,7 @@
import org.hibernate.Session;
import org.hibernate.Transaction;
+import org.hibernate.dialect.PostgreSQL81Dialect;
import org.hibernate.dialect.PostgreSQLDialect;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
@@ -65,7 +66,7 @@ public void testFormulaJoin() {
tx.commit();
s.close();
- if ( getDialect() instanceof PostgreSQLDialect ) return;
+ if ( getDialect() instanceof PostgreSQLDialect || getDialect() instanceof PostgreSQL81Dialect ) return;
s = openSession();
tx = s.beginTransaction();
@@ -53,6 +53,7 @@
import org.hibernate.dialect.IngresDialect;
import org.hibernate.dialect.MySQLDialect;
import org.hibernate.dialect.Oracle8iDialect;
+import org.hibernate.dialect.PostgreSQL81Dialect;
import org.hibernate.dialect.PostgreSQLDialect;
import org.hibernate.dialect.SQLServer2008Dialect;
import org.hibernate.dialect.SQLServerDialect;
@@ -451,7 +452,7 @@ public void testExpressionWithParamInFunction() {
else {
s.createQuery( "from Animal where lower(upper('foo') || upper(:bar)) like 'f%'" ).setString( "bar", "xyz" ).list();
}
- if ( ! ( getDialect() instanceof PostgreSQLDialect || getDialect() instanceof MySQLDialect ) ) {
+ if ( ! ( getDialect() instanceof PostgreSQLDialect|| getDialect() instanceof PostgreSQL81Dialect || getDialect() instanceof MySQLDialect ) ) {
s.createQuery( "from Animal where abs(cast(1 as float) - cast(:param as float)) = 1.0" ).setLong( "param", 1 ).list();
}
s.getTransaction().commit();
@@ -2751,15 +2752,15 @@ public void testEJBQLFunctions() throws Exception {
* PostgreSQL >= 8.3.7 typecasts are no longer automatically allowed
* <link>http://www.postgresql.org/docs/current/static/release-8-3.html</link>
*/
- if(getDialect() instanceof PostgreSQLDialect || getDialect() instanceof HSQLDialect){
+ if(getDialect() instanceof PostgreSQLDialect || getDialect() instanceof PostgreSQL81Dialect || getDialect() instanceof HSQLDialect){
hql = "from Animal a where bit_length(str(a.bodyWeight)) = 24";
}
else{
hql = "from Animal a where bit_length(a.bodyWeight) = 24";
}
session.createQuery(hql).list();
- if(getDialect() instanceof PostgreSQLDialect || getDialect() instanceof HSQLDialect){
+ if(getDialect() instanceof PostgreSQLDialect || getDialect() instanceof PostgreSQL81Dialect || getDialect() instanceof HSQLDialect){
hql = "select bit_length(str(a.bodyWeight)) from Animal a";
}else{
hql = "select bit_length(a.bodyWeight) from Animal a";
@@ -41,6 +41,7 @@
import org.hibernate.dialect.IngresDialect;
import org.hibernate.dialect.MySQLDialect;
import org.hibernate.dialect.Oracle8iDialect;
+import org.hibernate.dialect.PostgreSQL81Dialect;
import org.hibernate.dialect.PostgreSQLDialect;
import org.hibernate.dialect.SQLServerDialect;
import org.hibernate.dialect.Sybase11Dialect;
@@ -354,7 +355,7 @@ public void testExpressionWithParamInFunction() {
if ( !( getDialect() instanceof MySQLDialect ) && ! ( getDialect() instanceof SybaseDialect ) && ! ( getDialect() instanceof Sybase11Dialect ) && !( getDialect() instanceof SybaseASE15Dialect ) && ! ( getDialect() instanceof SybaseAnywhereDialect ) && ! ( getDialect() instanceof SQLServerDialect ) ) {
assertTranslation("from Animal where lower(upper('foo') || upper(:bar)) like 'f%'");
}
- if ( getDialect() instanceof PostgreSQLDialect ) {
+ if ( getDialect() instanceof PostgreSQLDialect || getDialect() instanceof PostgreSQL81Dialect ) {
return;
}
assertTranslation("from Animal where abs(cast(1 as float) - cast(:param as float)) = 1.0");
@@ -838,7 +839,7 @@ public void testOrderBy() throws Exception {
@Test
public void testGroupByFunction() {
if ( getDialect() instanceof Oracle8iDialect ) return; // the new hiearchy...
- if ( getDialect() instanceof PostgreSQLDialect ) return;
+ if ( getDialect() instanceof PostgreSQLDialect || getDialect() instanceof PostgreSQL81Dialect ) return;
if ( ! H2Dialect.class.isInstance( getDialect() ) ) {
// H2 has no year function
assertTranslation( "select count(*) from Human h group by year(h.birthdate)" );
@@ -34,7 +34,7 @@
/**
* @author Pawel Stawicki
*/
-@RequiresDialect( value = PostgreSQL81Dialect.class, jiraKey = "HHH-6580" )
+@RequiresDialect( value = {PostgreSQL81Dialect.class, PostgreSQLDialect.class}, jiraKey = "HHH-6580" )
public class PersistChildEntitiesWithDiscriminatorTest extends BaseCoreFunctionalTestCase {
@Override
protected Class<?>[] getAnnotatedClasses() {
@@ -40,7 +40,7 @@ public boolean isMatch(Dialect dialect) {
@Test
@RequiresDialectFeature( NonIdentityGeneratorChecker.class )
- @SkipForDialect( value = PostgreSQL81Dialect.class, jiraKey = "HHH-6704")
+ @SkipForDialect( value = {PostgreSQL81Dialect.class, PostgreSQLDialect.class}, jiraKey = "HHH-6704")
@SuppressWarnings( {"UnnecessaryBoxing"})
public void testInsert() throws HibernateException, SQLException {
Session s = openSession();
@@ -71,6 +71,7 @@
import org.hibernate.dialect.MySQLDialect;
import org.hibernate.dialect.Oracle8iDialect;
import org.hibernate.dialect.PointbaseDialect;
+import org.hibernate.dialect.PostgreSQL81Dialect;
import org.hibernate.dialect.PostgreSQLDialect;
import org.hibernate.dialect.SAPDBDialect;
import org.hibernate.dialect.Sybase11Dialect;
@@ -2293,7 +2294,7 @@ public void testCollectionsInSelect() throws Exception {
s.createQuery( "select count(*) from Baz as baz where 1 in indices(baz.fooArray)" ).list();
s.createQuery( "select count(*) from Bar as bar where 'abc' in elements(bar.baz.fooArray)" ).list();
s.createQuery( "select count(*) from Bar as bar where 1 in indices(bar.baz.fooArray)" ).list();
- if ( !(getDialect() instanceof DB2Dialect) && !(getDialect() instanceof Oracle8iDialect ) && !( getDialect() instanceof SybaseDialect ) && !( getDialect() instanceof Sybase11Dialect ) && !( getDialect() instanceof SybaseASE15Dialect ) && !( getDialect() instanceof PostgreSQLDialect )) {
+ if ( !(getDialect() instanceof DB2Dialect) && !(getDialect() instanceof Oracle8iDialect ) && !( getDialect() instanceof SybaseDialect ) && !( getDialect() instanceof Sybase11Dialect ) && !( getDialect() instanceof SybaseASE15Dialect ) && !( getDialect() instanceof PostgreSQLDialect ) && !(getDialect() instanceof PostgreSQL81Dialect)) {
// SybaseAnywhereDialect supports implicit conversions from strings to ints
s.createQuery(
"select count(*) from Bar as bar, bar.component.glarch.proxyArray as g where g.id in indices(bar.baz.fooArray)"
@@ -2368,7 +2369,7 @@ public void testCollectionsInSelect() throws Exception {
s.delete(bar);
- if ( getDialect() instanceof DB2Dialect || getDialect() instanceof PostgreSQLDialect ) {
+ if ( getDialect() instanceof DB2Dialect || getDialect() instanceof PostgreSQLDialect || getDialect() instanceof PostgreSQL81Dialect ) {
s.createQuery( "select one from One one join one.manies many group by one order by count(many)" ).iterate();
s.createQuery( "select one from One one join one.manies many group by one having count(many) < 5" )
.iterate();
@@ -57,7 +57,7 @@ public void checkAntlrParserSetting() {
protected boolean supportsLockingNullableSideOfJoin(Dialect dialect) {
// db2 and pgsql do *NOT*
- return ! ( DB2Dialect.class.isInstance( dialect ) || PostgreSQL81Dialect.class.isInstance( dialect ) );
+ return ! ( DB2Dialect.class.isInstance( dialect ) || PostgreSQL81Dialect.class.isInstance( dialect ) || PostgreSQLDialect.class.isInstance( dialect ));
}
protected static String extractFromSystem(String systemPropertyName) {
@@ -374,7 +374,7 @@ public void testFindBySQLParameters() throws HibernateException, SQLException {
}
@Test
- @SkipForDialect( { HSQLDialect.class, PostgreSQL81Dialect.class } )
+ @SkipForDialect( { HSQLDialect.class, PostgreSQL81Dialect.class, PostgreSQLDialect.class } )
public void testEscapedJDBC() throws HibernateException, SQLException {
Session session = openSession();
session.beginTransaction();
@@ -43,7 +43,7 @@
* @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com)
*/
@TestForIssue(jiraKey = "HHH-6780")
-@SkipForDialect( value = PostgreSQL81Dialect.class, comment = "PostgreSQL jdbc driver doesn't impl timeout method")
+@SkipForDialect( value ={ PostgreSQL81Dialect.class, PostgreSQLDialect.class}, comment = "PostgreSQL jdbc driver doesn't impl timeout method")
public class TransactionTimeoutTest extends BaseCoreFunctionalTestCase {
@Override
public String[] getMappings() {
@@ -70,7 +70,7 @@ public void testStandardBasicSqlTypeDescriptor() {
getDialect().remapSqlTypeDescriptor( BlobTypeDescriptor.DEFAULT )
);
}
- else if ( PostgreSQL81Dialect.class.isInstance( getDialect() ) ) {
+ else if ( PostgreSQL81Dialect.class.isInstance( getDialect() ) || PostgreSQLDialect.class.isInstance( getDialect() ) ) {
assertSame(
BlobTypeDescriptor.BLOB_BINDING,
getDialect().remapSqlTypeDescriptor( BlobTypeDescriptor.DEFAULT )

0 comments on commit d92e91b

Please sign in to comment.