HHH-13011 Fix the tests: use int column in where clause

This commit is contained in:
Gail Badner 2018-10-16 14:17:04 -07:00
parent 66d9859813
commit a09e6156f9
21 changed files with 51 additions and 52 deletions

View File

@ -83,7 +83,7 @@ public class EagerManyToOneFetchModeJoinWhereTest extends BaseNonConfigCoreFunct
session -> { session -> {
Category c = session.get( Category.class, category.id ); Category c = session.get( Category.class, category.id );
assertNotNull( c ); assertNotNull( c );
c.inactive = true; c.inactive = 1;
} }
); );
@ -131,7 +131,7 @@ public class EagerManyToOneFetchModeJoinWhereTest extends BaseNonConfigCoreFunct
@Entity(name = "Category") @Entity(name = "Category")
@Table(name = "CATEGORY") @Table(name = "CATEGORY")
@Where(clause = "not inactive") @Where(clause = "inactive = 0")
public static class Category { public static class Category {
@Id @Id
@GeneratedValue @GeneratedValue
@ -139,7 +139,7 @@ public class EagerManyToOneFetchModeJoinWhereTest extends BaseNonConfigCoreFunct
private String name; private String name;
private boolean inactive; private int inactive;
} }
@Embeddable @Embeddable

View File

@ -82,7 +82,7 @@ public class EagerManyToOneFetchModeSelectWhereTest extends BaseNonConfigCoreFun
session -> { session -> {
Category c = session.get( Category.class, category.id ); Category c = session.get( Category.class, category.id );
assertNotNull( c ); assertNotNull( c );
c.inactive = true; c.inactive = 1;
} }
); );
@ -130,7 +130,7 @@ public class EagerManyToOneFetchModeSelectWhereTest extends BaseNonConfigCoreFun
@Entity(name = "Category") @Entity(name = "Category")
@Table(name = "CATEGORY") @Table(name = "CATEGORY")
@Where(clause = "not inactive") @Where(clause = "inactive = 0")
public static class Category { public static class Category {
@Id @Id
@GeneratedValue @GeneratedValue
@ -138,7 +138,7 @@ public class EagerManyToOneFetchModeSelectWhereTest extends BaseNonConfigCoreFun
private String name; private String name;
private boolean inactive; private int inactive;
} }
@Embeddable @Embeddable

View File

@ -127,7 +127,7 @@ public class EagerToManyWhereDontUseClassWhereTest extends BaseNonConfigCoreFunc
session -> { session -> {
Category c = session.get( Category.class, flowers.id ); Category c = session.get( Category.class, flowers.id );
assertNotNull( c ); assertNotNull( c );
c.inactive = true; c.inactive = 1;
} }
); );
@ -186,7 +186,7 @@ public class EagerToManyWhereDontUseClassWhereTest extends BaseNonConfigCoreFunc
private Set<Category> categoriesManyToMany = new HashSet<>(); private Set<Category> categoriesManyToMany = new HashSet<>();
@ManyToMany(fetch = FetchType.EAGER) @ManyToMany(fetch = FetchType.EAGER)
@JoinTable(name = "categoriesWithDescManyToMany") @JoinTable(name = "categoriesWithDescManyToMany", inverseJoinColumns = { @JoinColumn( name = "categoryId" )})
@Where( clause = "description is not null" ) @Where( clause = "description is not null" )
private Set<Category> categoriesWithDescManyToMany = new HashSet<>(); private Set<Category> categoriesWithDescManyToMany = new HashSet<>();
@ -199,7 +199,7 @@ public class EagerToManyWhereDontUseClassWhereTest extends BaseNonConfigCoreFunc
@Entity(name = "Category") @Entity(name = "Category")
@Table(name = "CATEGORY") @Table(name = "CATEGORY")
@Where(clause = "not inactive") @Where(clause = "inactive = 0")
public static class Category { public static class Category {
@Id @Id
private int id; private int id;
@ -208,6 +208,6 @@ public class EagerToManyWhereDontUseClassWhereTest extends BaseNonConfigCoreFunc
private String description; private String description;
private boolean inactive; private int inactive;
} }
} }

View File

@ -24,7 +24,6 @@ import org.hibernate.annotations.WhereJoinTable;
import org.hibernate.testing.TestForIssue; import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase; import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase;
import org.junit.After;
import org.junit.Test; import org.junit.Test;
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate; import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
@ -122,7 +121,7 @@ public class EagerToManyWhereTest extends BaseNonConfigCoreFunctionalTestCase {
session -> { session -> {
Category c = session.get( Category.class, flowers.id ); Category c = session.get( Category.class, flowers.id );
assertNotNull( c ); assertNotNull( c );
c.inactive = true; c.inactive = 1;
} }
); );
@ -181,7 +180,7 @@ public class EagerToManyWhereTest extends BaseNonConfigCoreFunctionalTestCase {
private Set<Category> categoriesManyToMany = new HashSet<>(); private Set<Category> categoriesManyToMany = new HashSet<>();
@ManyToMany(fetch = FetchType.EAGER) @ManyToMany(fetch = FetchType.EAGER)
@JoinTable(name = "categoriesWithDescManyToMany") @JoinTable(name = "categoriesWithDescManyToMany", inverseJoinColumns = { @JoinColumn( name = "categoryId" )})
@Where( clause = "description is not null" ) @Where( clause = "description is not null" )
private Set<Category> categoriesWithDescManyToMany = new HashSet<>(); private Set<Category> categoriesWithDescManyToMany = new HashSet<>();
@ -194,7 +193,7 @@ public class EagerToManyWhereTest extends BaseNonConfigCoreFunctionalTestCase {
@Entity(name = "Category") @Entity(name = "Category")
@Table(name = "CATEGORY") @Table(name = "CATEGORY")
@Where(clause = "not inactive") @Where(clause = "inactive = 0")
public static class Category { public static class Category {
@Id @Id
private int id; private int id;
@ -203,6 +202,6 @@ public class EagerToManyWhereTest extends BaseNonConfigCoreFunctionalTestCase {
private String description; private String description;
private boolean inactive; private int inactive;
} }
} }

View File

@ -127,7 +127,7 @@ public class EagerToManyWhereUseClassWhereTest extends BaseNonConfigCoreFunction
session -> { session -> {
Category c = session.get( Category.class, flowers.id ); Category c = session.get( Category.class, flowers.id );
assertNotNull( c ); assertNotNull( c );
c.inactive = true; c.inactive = 1;
} }
); );
@ -186,7 +186,7 @@ public class EagerToManyWhereUseClassWhereTest extends BaseNonConfigCoreFunction
private Set<Category> categoriesManyToMany = new HashSet<>(); private Set<Category> categoriesManyToMany = new HashSet<>();
@ManyToMany(fetch = FetchType.EAGER) @ManyToMany(fetch = FetchType.EAGER)
@JoinTable(name = "categoriesWithDescManyToMany") @JoinTable(name = "categoriesWithDescManyToMany", inverseJoinColumns = { @JoinColumn( name = "categoryId" )})
@Where( clause = "description is not null" ) @Where( clause = "description is not null" )
private Set<Category> categoriesWithDescManyToMany = new HashSet<>(); private Set<Category> categoriesWithDescManyToMany = new HashSet<>();
@ -199,7 +199,7 @@ public class EagerToManyWhereUseClassWhereTest extends BaseNonConfigCoreFunction
@Entity(name = "Category") @Entity(name = "Category")
@Table(name = "CATEGORY") @Table(name = "CATEGORY")
@Where(clause = "not inactive") @Where(clause = "inactive = 0")
public static class Category { public static class Category {
@Id @Id
private int id; private int id;
@ -208,6 +208,6 @@ public class EagerToManyWhereUseClassWhereTest extends BaseNonConfigCoreFunction
private String description; private String description;
private boolean inactive; private int inactive;
} }
} }

View File

@ -127,7 +127,7 @@ public class LazyToManyWhereDontUseClassWhereTest extends BaseNonConfigCoreFunct
session -> { session -> {
Category c = session.get( Category.class, flowers.id ); Category c = session.get( Category.class, flowers.id );
assertNotNull( c ); assertNotNull( c );
c.inactive = true; c.inactive = 1;
} }
); );
@ -186,7 +186,7 @@ public class LazyToManyWhereDontUseClassWhereTest extends BaseNonConfigCoreFunct
private Set<Category> categoriesManyToMany = new HashSet<>(); private Set<Category> categoriesManyToMany = new HashSet<>();
@ManyToMany(fetch = FetchType.LAZY) @ManyToMany(fetch = FetchType.LAZY)
@JoinTable(name = "categoriesWithDescManyToMany") @JoinTable(name = "categoriesWithDescManyToMany", inverseJoinColumns = { @JoinColumn( name = "categoryId" )})
@Where( clause = "description is not null" ) @Where( clause = "description is not null" )
private Set<Category> categoriesWithDescManyToMany = new HashSet<>(); private Set<Category> categoriesWithDescManyToMany = new HashSet<>();
@ -199,7 +199,7 @@ public class LazyToManyWhereDontUseClassWhereTest extends BaseNonConfigCoreFunct
@Entity(name = "Category") @Entity(name = "Category")
@Table(name = "CATEGORY") @Table(name = "CATEGORY")
@Where(clause = "not inactive") @Where(clause = "inactive = 0")
public static class Category { public static class Category {
@Id @Id
private int id; private int id;
@ -208,6 +208,6 @@ public class LazyToManyWhereDontUseClassWhereTest extends BaseNonConfigCoreFunct
private String description; private String description;
private boolean inactive; private int inactive;
} }
} }

View File

@ -121,7 +121,7 @@ public class LazyToManyWhereTest extends BaseNonConfigCoreFunctionalTestCase {
session -> { session -> {
Category c = session.get( Category.class, flowers.id ); Category c = session.get( Category.class, flowers.id );
assertNotNull( c ); assertNotNull( c );
c.inactive = true; c.inactive = 1;
} }
); );
@ -180,7 +180,7 @@ public class LazyToManyWhereTest extends BaseNonConfigCoreFunctionalTestCase {
private Set<Category> categoriesManyToMany = new HashSet<>(); private Set<Category> categoriesManyToMany = new HashSet<>();
@ManyToMany(fetch = FetchType.LAZY) @ManyToMany(fetch = FetchType.LAZY)
@JoinTable(name = "categoriesWithDescManyToMany") @JoinTable(name = "categoriesWithDescManyToMany", inverseJoinColumns = { @JoinColumn( name = "categoryId" )})
@Where( clause = "description is not null" ) @Where( clause = "description is not null" )
private Set<Category> categoriesWithDescManyToMany = new HashSet<>(); private Set<Category> categoriesWithDescManyToMany = new HashSet<>();
@ -193,7 +193,7 @@ public class LazyToManyWhereTest extends BaseNonConfigCoreFunctionalTestCase {
@Entity(name = "Category") @Entity(name = "Category")
@Table(name = "CATEGORY") @Table(name = "CATEGORY")
@Where(clause = "not inactive") @Where(clause = "inactive = 0")
public static class Category { public static class Category {
@Id @Id
private int id; private int id;
@ -202,6 +202,6 @@ public class LazyToManyWhereTest extends BaseNonConfigCoreFunctionalTestCase {
private String description; private String description;
private boolean inactive; private int inactive;
} }
} }

View File

@ -127,7 +127,7 @@ public class LazyToManyWhereUseClassWhereTest extends BaseNonConfigCoreFunctiona
session -> { session -> {
Category c = session.get( Category.class, flowers.id ); Category c = session.get( Category.class, flowers.id );
assertNotNull( c ); assertNotNull( c );
c.inactive = true; c.inactive = 1;
} }
); );
@ -186,7 +186,7 @@ public class LazyToManyWhereUseClassWhereTest extends BaseNonConfigCoreFunctiona
private Set<Category> categoriesManyToMany = new HashSet<>(); private Set<Category> categoriesManyToMany = new HashSet<>();
@ManyToMany(fetch = FetchType.LAZY) @ManyToMany(fetch = FetchType.LAZY)
@JoinTable(name = "categoriesWithDescManyToMany") @JoinTable(name = "categoriesWithDescManyToMany", inverseJoinColumns = { @JoinColumn( name = "categoryId" )})
@Where( clause = "description is not null" ) @Where( clause = "description is not null" )
private Set<Category> categoriesWithDescManyToMany = new HashSet<>(); private Set<Category> categoriesWithDescManyToMany = new HashSet<>();
@ -199,7 +199,7 @@ public class LazyToManyWhereUseClassWhereTest extends BaseNonConfigCoreFunctiona
@Entity(name = "Category") @Entity(name = "Category")
@Table(name = "CATEGORY") @Table(name = "CATEGORY")
@Where(clause = "not inactive") @Where(clause = "inactive = 0")
public static class Category { public static class Category {
@Id @Id
private int id; private int id;
@ -208,6 +208,6 @@ public class LazyToManyWhereUseClassWhereTest extends BaseNonConfigCoreFunctiona
private String description; private String description;
private boolean inactive; private int inactive;
} }
} }

View File

@ -13,7 +13,7 @@ public class Category {
private String description; private String description;
private boolean inactive; private int inactive;
public int getId() { public int getId() {
return id; return id;
@ -39,11 +39,11 @@ public class Category {
this.description = description; this.description = description;
} }
public boolean isInactive() { public int getInactive() {
return inactive; return inactive;
} }
public void setInactive(boolean inactive) { public void setInactive(int inactive) {
this.inactive = inactive; this.inactive = inactive;
} }
} }

View File

@ -28,7 +28,7 @@
</class> </class>
<class name="EagerManyToOneFetchModeJoinWhereTest$Category" table="CATEGORY" where="not inactive"> <class name="EagerManyToOneFetchModeJoinWhereTest$Category" table="CATEGORY" where="inactive = 0">
<id name="id" column="ID"> <id name="id" column="ID">
<generator class="increment" /> <generator class="increment" />
</id> </id>

View File

@ -66,7 +66,7 @@ public class EagerManyToOneFetchModeJoinWhereTest extends BaseNonConfigCoreFunct
session -> { session -> {
Category c = session.get( Category.class, category.id ); Category c = session.get( Category.class, category.id );
assertNotNull( c ); assertNotNull( c );
c.inactive = true; c.inactive = 1;
} }
); );
@ -141,7 +141,7 @@ public class EagerManyToOneFetchModeJoinWhereTest extends BaseNonConfigCoreFunct
private String name; private String name;
private boolean inactive; private int inactive;
public int getId() { public int getId() {
return id; return id;
@ -159,11 +159,11 @@ public class EagerManyToOneFetchModeJoinWhereTest extends BaseNonConfigCoreFunct
this.name = name; this.name = name;
} }
public boolean isInactive() { public int getInactive() {
return inactive; return inactive;
} }
public void setInactive(boolean inactive) { public void setInactive(int inactive) {
this.inactive = inactive; this.inactive = inactive;
} }
} }

View File

@ -28,7 +28,7 @@
</class> </class>
<class name="EagerManyToOneFetchModeSelectWhereTest$Category" table="CATEGORY" where="not inactive"> <class name="EagerManyToOneFetchModeSelectWhereTest$Category" table="CATEGORY" where="inactive = 0">
<id name="id" column="ID"> <id name="id" column="ID">
<generator class="increment" /> <generator class="increment" />
</id> </id>

View File

@ -64,7 +64,7 @@ public class EagerManyToOneFetchModeSelectWhereTest extends BaseNonConfigCoreFun
session -> { session -> {
Category c = session.get( Category.class, category.id ); Category c = session.get( Category.class, category.id );
assertNotNull( c ); assertNotNull( c );
c.inactive = true; c.inactive = 1;
} }
); );
@ -139,7 +139,7 @@ public class EagerManyToOneFetchModeSelectWhereTest extends BaseNonConfigCoreFun
private String name; private String name;
private boolean inactive; private int inactive;
public int getId() { public int getId() {
return id; return id;
@ -157,11 +157,11 @@ public class EagerManyToOneFetchModeSelectWhereTest extends BaseNonConfigCoreFun
this.name = name; this.name = name;
} }
public boolean isInactive() { public int getInactive() {
return inactive; return inactive;
} }
public void setInactive(boolean inactive) { public void setInactive(int inactive) {
this.inactive = inactive; this.inactive = inactive;
} }
} }

View File

@ -39,7 +39,7 @@
</class> </class>
<class name="Category" table="CATEGORY" where="not inactive"> <class name="Category" table="CATEGORY" where="inactive = 0">
<id name="id" column="ID"/> <id name="id" column="ID"/>
<property name="name"/> <property name="name"/>

View File

@ -116,7 +116,7 @@ public class EagerToManyWhereDontUseClassWhereTest extends BaseNonConfigCoreFunc
session -> { session -> {
Category c = session.get( Category.class, flowers.getId() ); Category c = session.get( Category.class, flowers.getId() );
assertNotNull( c ); assertNotNull( c );
c.setInactive( true ); c.setInactive( 1 );
} }
); );

View File

@ -109,7 +109,7 @@ public class EagerToManyWhereTest extends BaseNonConfigCoreFunctionalTestCase {
session -> { session -> {
Category c = session.get( Category.class, flowers.getId() ); Category c = session.get( Category.class, flowers.getId() );
assertNotNull( c ); assertNotNull( c );
c.setInactive( true ); c.setInactive( 1 );
} }
); );

View File

@ -116,7 +116,7 @@ public class EagerToManyWhereUseClassWhereTest extends BaseNonConfigCoreFunction
session -> { session -> {
Category c = session.get( Category.class, flowers.getId() ); Category c = session.get( Category.class, flowers.getId() );
assertNotNull( c ); assertNotNull( c );
c.setInactive( true ); c.setInactive( 1 );
} }
); );

View File

@ -39,7 +39,7 @@
</class> </class>
<class name="Category" table="CATEGORY" where="not inactive"> <class name="Category" table="CATEGORY" where="inactive = 0">
<id name="id" column="ID"/> <id name="id" column="ID"/>
<property name="name"/> <property name="name"/>

View File

@ -116,7 +116,7 @@ public class LazyToManyWhereDontUseClassWhereTest extends BaseNonConfigCoreFunct
session -> { session -> {
Category c = session.get( Category.class, flowers.getId() ); Category c = session.get( Category.class, flowers.getId() );
assertNotNull( c ); assertNotNull( c );
c.setInactive( true ); c.setInactive( 1 );
} }
); );

View File

@ -109,7 +109,7 @@ public class LazyToManyWhereTest extends BaseNonConfigCoreFunctionalTestCase {
session -> { session -> {
Category c = session.get( Category.class, flowers.getId() ); Category c = session.get( Category.class, flowers.getId() );
assertNotNull( c ); assertNotNull( c );
c.setInactive( true ); c.setInactive( 1 );
} }
); );

View File

@ -116,7 +116,7 @@ public class LazyToManyWhereUseClassWhereTest extends BaseNonConfigCoreFunctiona
session -> { session -> {
Category c = session.get( Category.class, flowers.getId() ); Category c = session.get( Category.class, flowers.getId() );
assertNotNull( c ); assertNotNull( c );
c.setInactive( true ); c.setInactive( 1 );
} }
); );