HHH-6836 some test failures on Oracle
This commit is contained in:
parent
b2ba384254
commit
c4776e2a92
|
@ -31,6 +31,7 @@ import org.junit.Test;
|
||||||
import org.hibernate.Session;
|
import org.hibernate.Session;
|
||||||
import org.hibernate.Transaction;
|
import org.hibernate.Transaction;
|
||||||
import org.hibernate.dialect.HSQLDialect;
|
import org.hibernate.dialect.HSQLDialect;
|
||||||
|
import org.hibernate.dialect.Oracle8iDialect;
|
||||||
import org.hibernate.dialect.SQLServer2005Dialect;
|
import org.hibernate.dialect.SQLServer2005Dialect;
|
||||||
import org.hibernate.testing.RequiresDialect;
|
import org.hibernate.testing.RequiresDialect;
|
||||||
import org.hibernate.testing.SkipForDialect;
|
import org.hibernate.testing.SkipForDialect;
|
||||||
|
@ -153,7 +154,8 @@ public class ManyToOneWithFormulaTest extends BaseCoreFunctionalTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SkipForDialect(value = { HSQLDialect.class, SQLServer2005Dialect.class }, comment = "The used join conditions does not work in HSQLDB. See HHH-4497")
|
@SkipForDialect(value = { HSQLDialect.class, SQLServer2005Dialect.class, Oracle8iDialect.class },
|
||||||
|
comment = "The used join conditions does not work in HSQLDB. See HHH-4497. And oracle does not support 'substring' function, it uses 'substr'")
|
||||||
public void testManyToOneFromNonPkToNonPk() throws Exception {
|
public void testManyToOneFromNonPkToNonPk() throws Exception {
|
||||||
// also tests usage of the stand-alone @JoinFormula annotation (i.e. not wrapped within @JoinColumnsOrFormulas)
|
// also tests usage of the stand-alone @JoinFormula annotation (i.e. not wrapped within @JoinColumnsOrFormulas)
|
||||||
Session s = openSession();
|
Session s = openSession();
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
package org.hibernate.test.criteria;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Strong Liu <stliu@hibernate.org>
|
||||||
|
*/
|
||||||
|
public enum Code {
|
||||||
|
ADM, CEN, RPA, RPP, PRJ, HUB, RQS, OAD, ORP, ORQ
|
||||||
|
}
|
|
@ -25,15 +25,6 @@
|
||||||
package org.hibernate.test.criteria;
|
package org.hibernate.test.criteria;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.EnumType;
|
|
||||||
import javax.persistence.Enumerated;
|
|
||||||
import javax.persistence.Id;
|
|
||||||
import javax.persistence.IdClass;
|
|
||||||
import javax.persistence.JoinColumn;
|
|
||||||
import javax.persistence.ManyToOne;
|
|
||||||
import javax.persistence.MappedSuperclass;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -104,45 +95,6 @@ import static org.junit.Assert.assertEquals;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class ComplexJoinAliasTest extends BaseCoreFunctionalTestCase {
|
public class ComplexJoinAliasTest extends BaseCoreFunctionalTestCase {
|
||||||
@MappedSuperclass
|
|
||||||
private static abstract class VersionedRecord implements java.io.Serializable {
|
|
||||||
Long recordVersion;
|
|
||||||
Boolean isDeleted;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Entity
|
|
||||||
@IdClass(ListActionRole.class)
|
|
||||||
public static class ListActionRole extends VersionedRecord {
|
|
||||||
@Id
|
|
||||||
@Enumerated(EnumType.STRING)
|
|
||||||
Code roleCode;
|
|
||||||
|
|
||||||
@ManyToOne(targetEntity = Role.class)
|
|
||||||
@JoinColumn(nullable = false)
|
|
||||||
Role role;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "ListActionRole.Id(roleCode=" + roleCode + ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return toString().hashCode();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Entity
|
|
||||||
@Table(name = "roles")
|
|
||||||
public static class Role extends VersionedRecord {
|
|
||||||
@Id
|
|
||||||
@Enumerated(EnumType.STRING)
|
|
||||||
Code code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static enum Code {
|
|
||||||
ADM, CEN, RPA, RPP, PRJ, HUB, RQS, OAD, ORP, ORQ
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Class<?>[] getAnnotatedClasses() {
|
protected Class<?>[] getAnnotatedClasses() {
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
package org.hibernate.test.criteria;
|
||||||
|
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.EnumType;
|
||||||
|
import javax.persistence.Enumerated;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.IdClass;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Strong Liu <stliu@hibernate.org>
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@IdClass(ListActionRole.class)
|
||||||
|
public class ListActionRole extends VersionedRecord {
|
||||||
|
@Id
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
Code roleCode;
|
||||||
|
|
||||||
|
@ManyToOne(targetEntity = Role.class)
|
||||||
|
@JoinColumn(nullable = false)
|
||||||
|
Role role;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ListActionRole.Id(roleCode=" + roleCode + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return toString().hashCode();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package org.hibernate.test.criteria;
|
||||||
|
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.EnumType;
|
||||||
|
import javax.persistence.Enumerated;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Strong Liu <stliu@hibernate.org>
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Table(name = "roles")
|
||||||
|
public class Role extends VersionedRecord {
|
||||||
|
@Id
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
Code code;
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package org.hibernate.test.criteria;
|
||||||
|
|
||||||
|
import javax.persistence.MappedSuperclass;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Strong Liu <stliu@hibernate.org>
|
||||||
|
*/
|
||||||
|
@MappedSuperclass
|
||||||
|
abstract class VersionedRecord implements java.io.Serializable {
|
||||||
|
Long recordVersion;
|
||||||
|
Boolean isDeleted;
|
||||||
|
}
|
|
@ -27,6 +27,7 @@ import org.junit.Test;
|
||||||
|
|
||||||
import org.hibernate.Session;
|
import org.hibernate.Session;
|
||||||
import org.hibernate.cfg.Configuration;
|
import org.hibernate.cfg.Configuration;
|
||||||
|
import org.hibernate.cfg.Environment;
|
||||||
import org.hibernate.dialect.Oracle9iDialect;
|
import org.hibernate.dialect.Oracle9iDialect;
|
||||||
import org.hibernate.testing.RequiresDialect;
|
import org.hibernate.testing.RequiresDialect;
|
||||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||||
|
@ -38,7 +39,12 @@ import static org.junit.Assert.assertNotNull;
|
||||||
@RequiresDialect( Oracle9iDialect.class )
|
@RequiresDialect( Oracle9iDialect.class )
|
||||||
public class SequenceIdentityTest extends BaseCoreFunctionalTestCase {
|
public class SequenceIdentityTest extends BaseCoreFunctionalTestCase {
|
||||||
public void configure(Configuration cfg) {
|
public void configure(Configuration cfg) {
|
||||||
super.configure( cfg );
|
//this test makes no sense w/o the following property enabled
|
||||||
|
//note : this property is set to false by default in Oracle9iDialect
|
||||||
|
//but if this property is set to false, then the AssertionFailure will
|
||||||
|
//be thrown by {@link org.hibernate.engine.jdbc.internal.StatementPreparerImpl.checkAutoGeneratedKeysSupportEnabled()}
|
||||||
|
//so let just change this here and this should be invested deeper.
|
||||||
|
cfg.setProperty( Environment.USE_GET_GENERATED_KEYS, "true" );
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getMappings() {
|
public String[] getMappings() {
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
</id>
|
</id>
|
||||||
<property name="description" type="string"/>
|
<property name="description" type="string"/>
|
||||||
<many-to-one name="user" column="`user`"/>
|
<many-to-one name="user" column="`user`"/>
|
||||||
<many-to-one name="resource"/>
|
<many-to-one name="resource" column="`resource`"/>
|
||||||
<property name="dueDate" type="timestamp"/>
|
<property name="dueDate" type="timestamp"/>
|
||||||
<property name="startDate" type="timestamp"/>
|
<property name="startDate" type="timestamp"/>
|
||||||
<property name="completionDate" type="timestamp"/>
|
<property name="completionDate" type="timestamp"/>
|
||||||
|
|
Loading…
Reference in New Issue