HHH-7819 Correct test issues found in CI hibernate-core-master-matrix

job
This commit is contained in:
Brett Meyer 2012-11-21 12:53:13 -05:00
parent 5d2f21a01e
commit 8df655aa6b
6 changed files with 46 additions and 5 deletions

View File

@ -30,6 +30,8 @@ import javax.persistence.FetchType;
import javax.persistence.MapKeyColumn;
import javax.persistence.MapKeyEnumerated;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import java.util.EnumMap;
import java.util.Map;
@ -38,6 +40,7 @@ import java.util.Map;
* @author Steve Ebersole
*/
@Entity
@Table( name = "USER_TABLE" )
public class User {
@javax.persistence.Id
@javax.persistence.GeneratedValue(generator = "system-uuid")

View File

@ -29,6 +29,7 @@ import org.hibernate.IrrelevantEntity;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
import org.hibernate.criterion.CriteriaQuery;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.LikeExpression;
@ -42,6 +43,7 @@ import org.hibernate.type.Type;
import org.junit.Test;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.hibernate.testing.junit4.BaseUnitTestCase;
import static org.junit.Assert.assertEquals;
@ -49,12 +51,13 @@ import static org.junit.Assert.assertEquals;
/**
* @author Steve Ebersole
*/
public class CriterionTest extends BaseUnitTestCase {
public class CriterionTest extends BaseCoreFunctionalTestCase {
@Test
public void testIlikeRendering() {
SessionFactory sf = new Configuration()
.addAnnotatedClass( IrrelevantEntity.class )
.setProperty( AvailableSettings.DIALECT, IlikeSupportingDialect.class.getName() )
.setProperty( Environment.HBM2DDL_AUTO, "create-drop" )
.buildSessionFactory();
final Criteria criteria = sf.openSession().createCriteria( IrrelevantEntity.class );
final CriteriaQueryTranslator translator = new CriteriaQueryTranslator(
@ -73,6 +76,7 @@ public class CriterionTest extends BaseUnitTestCase {
SessionFactory sf = new Configuration()
.addAnnotatedClass( IrrelevantEntity.class )
.setProperty( AvailableSettings.DIALECT, NonIlikeSupportingDialect.class.getName() )
.setProperty( Environment.HBM2DDL_AUTO, "create-drop" )
.buildSessionFactory();
final Criteria criteria = sf.openSession().createCriteria( IrrelevantEntity.class );
final CriteriaQueryTranslator translator = new CriteriaQueryTranslator(

View File

@ -2,6 +2,9 @@ package org.hibernate.test.hqlfetchscroll;
public class Child {
// A numeric id must be the <id> field. Some databases (Sybase, etc.)
// require identifier columns in order to support scrollable results.
private long id;
private String name;
Child() {
@ -11,6 +14,14 @@ public class Child {
this.name = name;
}
public long getId() {
return id;
}
void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}

View File

@ -176,8 +176,8 @@ public class HQLScrollFetchTest extends BaseCoreFunctionalTestCase {
}
}
// check that the same second parent is obtained by calling Session.get()
assertSame( pOther, s.get( Parent.class, "parent2" ) );
assertNotNull( pOther );
assertSame( pOther, s.get( Parent.class, pOther.getId() ) );
// access pOther's collection; should be completely loaded
assertTrue( Hibernate.isInitialized( pOther.getChildren() ) );
assertEquals( childrenOther, pOther.getChildren() );

View File

@ -4,6 +4,10 @@ import java.util.HashSet;
import java.util.Set;
public class Parent {
// A numeric id must be the <id> field. Some databases (Sybase, etc.)
// require identifier columns in order to support scrollable results.
private long id;
private String name;
private Set children = new HashSet();
@ -14,11 +18,18 @@ public class Parent {
this.name = name;
}
public long getId() {
return id;
}
void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
void setName(String name) {
this.name = name;
}

View File

@ -6,7 +6,13 @@
<hibernate-mapping package="org.hibernate.test.hqlfetchscroll">
<class name="Parent" table="Parents">
<id name="name"/>
<!-- A numeric id must be the <id> field. Some databases (Sybase, etc.)
require identifier columns in order to support scrollable results. -->
<id name="id">
<generator class="identity"/>
</id>
<property name="name"/>
<set name="children" cascade="all-delete-orphan" lazy="false">
<key column="parent_id"/>
@ -16,7 +22,13 @@
</class>
<class name="Child" table="chlidren">
<id name="name"/>
<!-- A numeric id must be the <id> field. Some databases (Sybase, etc.)
require identifier columns in order to support scrollable results. -->
<id name="id">
<generator class="identity"/>
</id>
<property name="name"/>
</class>