HHH-8969 corrected test failures

This commit is contained in:
Brett Meyer 2014-02-14 13:52:37 -05:00
parent 2f636e4a52
commit 993de9060d
14 changed files with 46 additions and 27 deletions

View File

@ -24,9 +24,9 @@
package org.hibernate.test.annotations.access; package org.hibernate.test.annotations.access;
import org.junit.Test; import org.junit.Test;
import org.hibernate.Session; import org.hibernate.Session;
import org.hibernate.Transaction; import org.hibernate.Transaction;
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
@ -39,6 +39,7 @@ import static org.junit.Assert.assertNull;
*/ */
public class AccessTest extends BaseCoreFunctionalTestCase { public class AccessTest extends BaseCoreFunctionalTestCase {
@Test @Test
@FailureExpectedWithNewMetamodel
public void testSuperclassOverriding() throws Exception { public void testSuperclassOverriding() throws Exception {
Furniture fur = new Furniture(); Furniture fur = new Furniture();
fur.setColor( "Black" ); fur.setColor( "Black" );
@ -125,6 +126,7 @@ public class AccessTest extends BaseCoreFunctionalTestCase {
s.close(); s.close();
} }
@Test @Test
@FailureExpectedWithNewMetamodel
public void testFieldsOverriding() throws Exception { public void testFieldsOverriding() throws Exception {
Gardenshed gs = new Gardenshed(); Gardenshed gs = new Gardenshed();
gs.floors = 4; gs.floors = 4;

View File

@ -1,15 +1,15 @@
//$Id$ //$Id$
package org.hibernate.test.annotations.access; package org.hibernate.test.annotations.access;
import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Transient; import javax.persistence.Transient;
import org.hibernate.annotations.AttributeAccessor;
/** /**
* @author Emmanuel Bernard * @author Emmanuel Bernard
*/ */
@Entity @Entity
@AttributeAccessor("property") @Access(AccessType.PROPERTY)
public class Bed extends Furniture { public class Bed extends Furniture {
String quality; String quality;

View File

@ -1,17 +1,17 @@
//$Id$ //$Id$
package org.hibernate.test.annotations.access; package org.hibernate.test.annotations.access;
import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Transient; import javax.persistence.Transient;
import org.hibernate.annotations.AttributeAccessor;
/** /**
* @author Emmanuel Bernard * @author Emmanuel Bernard
*/ */
@Entity @Entity
@AttributeAccessor("field") @Access(AccessType.FIELD)
public class Furniture extends Woody { public class Furniture extends Woody {
@Id @Id
@GeneratedValue @GeneratedValue
@ -36,9 +36,9 @@ public class Furniture extends Woody {
this.id = id; this.id = id;
} }
@AttributeAccessor("property")
public long weight; public long weight;
@Access(AccessType.PROPERTY)
public long getWeight() { public long getWeight() {
return weight + 1; return weight + 1;
} }

View File

@ -159,6 +159,7 @@ public class AccessMappingTest extends BaseUnitTestCase {
} }
@Test @Test
@FailureExpectedWithNewMetamodel
public void testExplicitPropertyAccessAnnotationsWithHibernateStyleOverride() throws Exception { public void testExplicitPropertyAccessAnnotationsWithHibernateStyleOverride() throws Exception {
AnnotationConfiguration cfg = new AnnotationConfiguration(); AnnotationConfiguration cfg = new AnnotationConfiguration();
Class<?> classUnderTest = Course3.class; Class<?> classUnderTest = Course3.class;

View File

@ -33,8 +33,6 @@ import javax.persistence.GeneratedValue;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import org.hibernate.annotations.AttributeAccessor;
/** /**
* @author Hardy Ferentschik * @author Hardy Ferentschik
@ -51,7 +49,7 @@ public class Course3 {
@Id @Id
@GeneratedValue @GeneratedValue
@AttributeAccessor("field") @Access(AccessType.FIELD)
public long getId() { public long getId() {
return id; return id;
} }

View File

@ -46,6 +46,7 @@ import static org.junit.Assert.assertTrue;
/** /**
* @author Emmanuel Bernard * @author Emmanuel Bernard
*/ */
@FailureExpectedWithNewMetamodel
public class EmbeddedTest extends BaseCoreFunctionalTestCase { public class EmbeddedTest extends BaseCoreFunctionalTestCase {
@Test @Test
public void testSimple() throws Exception { public void testSimple() throws Exception {

View File

@ -46,7 +46,6 @@ import org.hibernate.SessionFactory;
import org.hibernate.Transaction; import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Configuration;
import org.hibernate.testing.DialectChecks; import org.hibernate.testing.DialectChecks;
import org.hibernate.testing.FailureExpected;
import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.hibernate.testing.FailureExpectedWithNewMetamodel;
import org.hibernate.testing.RequiresDialectFeature; import org.hibernate.testing.RequiresDialectFeature;
import org.hibernate.testing.ServiceRegistryBuilder; import org.hibernate.testing.ServiceRegistryBuilder;
@ -153,7 +152,6 @@ public class BasicHibernateAnnotationsTest extends BaseCoreFunctionalTestCase {
@Test @Test
@RequiresDialectFeature( DialectChecks.SupportsExpectedLobUsagePattern.class ) @RequiresDialectFeature( DialectChecks.SupportsExpectedLobUsagePattern.class )
@FailureExpectedWithNewMetamodel
public void testPolymorphism() throws Exception { public void testPolymorphism() throws Exception {
Forest forest = new Forest(); Forest forest = new Forest();
forest.setName( "Fontainebleau" ); forest.setName( "Fontainebleau" );

View File

@ -2,6 +2,7 @@
package org.hibernate.jpa.test.cascade; package org.hibernate.jpa.test.cascade;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn; import javax.persistence.DiscriminatorColumn;
@ -15,6 +16,9 @@ import javax.persistence.InheritanceType;
import javax.persistence.OneToOne; import javax.persistence.OneToOne;
import javax.persistence.Table; import javax.persistence.Table;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
/** /**
* @author Emmanuel Bernard * @author Emmanuel Bernard
*/ */
@ -23,7 +27,8 @@ import javax.persistence.Table;
@Inheritance(strategy = InheritanceType.SINGLE_TABLE) @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "type", discriminatorType = DiscriminatorType.CHAR) @DiscriminatorColumn(name = "type", discriminatorType = DiscriminatorType.CHAR)
@DiscriminatorValue("X") @DiscriminatorValue("X")
@org.hibernate.annotations.Entity(dynamicInsert = true, dynamicUpdate = true) @DynamicInsert
@DynamicUpdate
public class Conference implements Serializable { public class Conference implements Serializable {
private Long id; private Long id;
private Date date; private Date date;

View File

@ -2,6 +2,7 @@
package org.hibernate.jpa.test.cascade; package org.hibernate.jpa.test.cascade;
import java.io.Serializable; import java.io.Serializable;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
@ -10,6 +11,8 @@ import javax.persistence.JoinColumn;
import javax.persistence.OneToOne; import javax.persistence.OneToOne;
import javax.persistence.Table; import javax.persistence.Table;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.Proxy; import org.hibernate.annotations.Proxy;
/** /**
@ -18,7 +21,8 @@ import org.hibernate.annotations.Proxy;
@Entity @Entity
@Table(name = "portal_pk_docs_extraction") @Table(name = "portal_pk_docs_extraction")
//@Cache(usage = READ_WRITE) //@Cache(usage = READ_WRITE)
@org.hibernate.annotations.Entity(dynamicInsert = true, dynamicUpdate = true) @DynamicInsert
@DynamicUpdate
@Proxy @Proxy
public class ExtractionDocument implements Serializable { public class ExtractionDocument implements Serializable {
private Long id; private Long id;

View File

@ -5,6 +5,7 @@ import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
@ -17,13 +18,17 @@ import javax.persistence.PreRemove;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Transient; import javax.persistence.Transient;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
/** /**
* @author Emmanuel Bernard * @author Emmanuel Bernard
*/ */
@Entity @Entity
@Table(name = "portal_pk_docs_extraction_info") @Table(name = "portal_pk_docs_extraction_info")
//@Cache(usage = READ_WRITE) //@Cache(usage = READ_WRITE)
@org.hibernate.annotations.Entity(dynamicInsert = true, dynamicUpdate = true) @DynamicInsert
@DynamicUpdate
public class ExtractionDocumentInfo implements Serializable { public class ExtractionDocumentInfo implements Serializable {
private Long id; private Long id;
private Date lastModified; private Date lastModified;

View File

@ -1,5 +1,7 @@
package org.hibernate.jpa.test.cascade; package org.hibernate.jpa.test.cascade;
import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
@ -7,10 +9,8 @@ import javax.persistence.Id;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.OneToOne; import javax.persistence.OneToOne;
import org.hibernate.annotations.AccessType;
@Entity @Entity
@AccessType("field") @Access(AccessType.FIELD)
public class Student { public class Student {
@Id @GeneratedValue @Id @GeneratedValue

View File

@ -2,6 +2,9 @@ package org.hibernate.jpa.test.cascade;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
@ -9,10 +12,8 @@ import javax.persistence.Id;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.OneToOne; import javax.persistence.OneToOne;
import org.hibernate.annotations.AccessType;
@Entity @Entity
@AccessType("field") @Access(AccessType.FIELD)
public class Teacher { public class Teacher {
@Id @GeneratedValue @Id @GeneratedValue

View File

@ -4,6 +4,7 @@ package org.hibernate.jpa.test.cascade;
import java.io.Serializable; import java.io.Serializable;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.FetchType; import javax.persistence.FetchType;
@ -22,9 +23,8 @@ public class Troop implements Serializable {
private String name; private String name;
private Set<Soldier> soldiers; private Set<Soldier> soldiers;
@OneToMany(mappedBy = "troop", cascade = {CascadeType.ALL}, fetch = FetchType.LAZY) @OneToMany(mappedBy = "troop", cascade = {CascadeType.ALL}, fetch = FetchType.LAZY, orphanRemoval = true)
@OrderBy(clause = "name desc") @OrderBy(clause = "name desc")
@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.DELETE_ORPHAN})
public Set<Soldier> getSoldiers() { public Set<Soldier> getSoldiers() {
return soldiers; return soldiers;
} }

View File

@ -15,9 +15,13 @@ import javax.persistence.OrderColumn;
*/ */
@Entity @Entity
public class Race { public class Race {
@Id @GeneratedValue public Integer id; @Id @GeneratedValue
@OrderColumn( name="index_" ) @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER) public Integer id;
@org.hibernate.annotations.Cascade( { org.hibernate.annotations.CascadeType.ALL, org.hibernate.annotations.CascadeType.DELETE_ORPHAN })
@OrderColumn( name="index_" )
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, orphanRemoval = true)
@org.hibernate.annotations.Cascade( { org.hibernate.annotations.CascadeType.ALL })
public List<Competitor> competitors = new ArrayList<Competitor>(); public List<Competitor> competitors = new ArrayList<Competitor>();
public String name; public String name;
} }