Re-enabled additional tests
This commit is contained in:
parent
ead64b3ec9
commit
47eee7cfe4
|
@ -5,7 +5,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade;
|
package org.hibernate.orm.test.annotations.cascade;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade;
|
package org.hibernate.orm.test.annotations.cascade;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade;
|
package org.hibernate.orm.test.annotations.cascade;
|
||||||
|
|
||||||
import javax.persistence.CascadeType;
|
import javax.persistence.CascadeType;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade;
|
package org.hibernate.orm.test.annotations.cascade;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade;
|
package org.hibernate.orm.test.annotations.cascade;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//$Id$
|
//$Id$
|
||||||
package org.hibernate.test.annotations.cascade;
|
package org.hibernate.orm.test.annotations.cascade;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade;
|
package org.hibernate.orm.test.annotations.cascade;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade;
|
package org.hibernate.orm.test.annotations.cascade;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javax.persistence.CascadeType;
|
import javax.persistence.CascadeType;
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade;
|
package org.hibernate.orm.test.annotations.cascade;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade;
|
package org.hibernate.orm.test.annotations.cascade;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import javax.persistence.CascadeType;
|
import javax.persistence.CascadeType;
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//$Id$
|
//$Id$
|
||||||
package org.hibernate.test.annotations.cascade;
|
package org.hibernate.orm.test.annotations.cascade;
|
||||||
import javax.persistence.CascadeType;
|
import javax.persistence.CascadeType;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.circle.identity;
|
package org.hibernate.orm.test.annotations.cascade.circle.identity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Documentation
|
* No Documentation
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.circle.identity;
|
package org.hibernate.orm.test.annotations.cascade.circle.identity;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.circle.identity;
|
package org.hibernate.orm.test.annotations.cascade.circle.identity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Documentation
|
* No Documentation
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.circle.identity;
|
package org.hibernate.orm.test.annotations.cascade.circle.identity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Documentation
|
* No Documentation
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.circle.identity;
|
package org.hibernate.orm.test.annotations.cascade.circle.identity;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.circle.identity;
|
package org.hibernate.orm.test.annotations.cascade.circle.identity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Documentation
|
* No Documentation
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.circle.identity;
|
package org.hibernate.orm.test.annotations.cascade.circle.identity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Documentation
|
* No Documentation
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.circle.identity;
|
package org.hibernate.orm.test.annotations.cascade.circle.identity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Documentation
|
* No Documentation
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.circle.identity;
|
package org.hibernate.orm.test.annotations.cascade.circle.identity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Documentation
|
* No Documentation
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.circle.identity;
|
package org.hibernate.orm.test.annotations.cascade.circle.identity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Documentation
|
* No Documentation
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.circle.sequence;
|
package org.hibernate.orm.test.annotations.cascade.circle.sequence;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Documentation
|
* No Documentation
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.circle.sequence;
|
package org.hibernate.orm.test.annotations.cascade.circle.sequence;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.circle.sequence;
|
package org.hibernate.orm.test.annotations.cascade.circle.sequence;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Documentation
|
* No Documentation
|
||||||
|
@ -27,7 +27,7 @@ public class B extends AbstractEntity {
|
||||||
@javax.persistence.ManyToOne(cascade = {
|
@javax.persistence.ManyToOne(cascade = {
|
||||||
javax.persistence.CascadeType.MERGE, javax.persistence.CascadeType.PERSIST, javax.persistence.CascadeType.REFRESH}
|
javax.persistence.CascadeType.MERGE, javax.persistence.CascadeType.PERSIST, javax.persistence.CascadeType.REFRESH}
|
||||||
, optional = false)
|
, optional = false)
|
||||||
private org.hibernate.test.annotations.cascade.circle.sequence.A a;
|
private org.hibernate.orm.test.annotations.cascade.circle.sequence.A a;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No documentation
|
* No documentation
|
||||||
|
@ -46,11 +46,11 @@ public class B extends AbstractEntity {
|
||||||
this.cCollection = parameter;
|
this.cCollection = parameter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public org.hibernate.test.annotations.cascade.circle.sequence.A getA() {
|
public org.hibernate.orm.test.annotations.cascade.circle.sequence.A getA() {
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setA(org.hibernate.test.annotations.cascade.circle.sequence.A parameter) {
|
public void setA(org.hibernate.orm.test.annotations.cascade.circle.sequence.A parameter) {
|
||||||
this.a = parameter;
|
this.a = parameter;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.circle.sequence;
|
package org.hibernate.orm.test.annotations.cascade.circle.sequence;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Documentation
|
* No Documentation
|
||||||
|
@ -19,7 +19,7 @@ public class C extends AbstractEntity {
|
||||||
@javax.persistence.ManyToOne(cascade = {
|
@javax.persistence.ManyToOne(cascade = {
|
||||||
javax.persistence.CascadeType.MERGE, javax.persistence.CascadeType.PERSIST, javax.persistence.CascadeType.REFRESH}
|
javax.persistence.CascadeType.MERGE, javax.persistence.CascadeType.PERSIST, javax.persistence.CascadeType.REFRESH}
|
||||||
, optional = false)
|
, optional = false)
|
||||||
private org.hibernate.test.annotations.cascade.circle.sequence.A a;
|
private org.hibernate.orm.test.annotations.cascade.circle.sequence.A a;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No documentation
|
* No documentation
|
||||||
|
@ -35,13 +35,13 @@ public class C extends AbstractEntity {
|
||||||
@javax.persistence.ManyToOne(cascade = {
|
@javax.persistence.ManyToOne(cascade = {
|
||||||
javax.persistence.CascadeType.MERGE, javax.persistence.CascadeType.PERSIST, javax.persistence.CascadeType.REFRESH}
|
javax.persistence.CascadeType.MERGE, javax.persistence.CascadeType.PERSIST, javax.persistence.CascadeType.REFRESH}
|
||||||
, optional = false)
|
, optional = false)
|
||||||
private org.hibernate.test.annotations.cascade.circle.sequence.B b;
|
private org.hibernate.orm.test.annotations.cascade.circle.sequence.B b;
|
||||||
|
|
||||||
public org.hibernate.test.annotations.cascade.circle.sequence.A getA() {
|
public org.hibernate.orm.test.annotations.cascade.circle.sequence.A getA() {
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setA(org.hibernate.test.annotations.cascade.circle.sequence.A parameter) {
|
public void setA(org.hibernate.orm.test.annotations.cascade.circle.sequence.A parameter) {
|
||||||
this.a = parameter;
|
this.a = parameter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,11 +53,11 @@ public class C extends AbstractEntity {
|
||||||
this.g = parameter;
|
this.g = parameter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public org.hibernate.test.annotations.cascade.circle.sequence.B getB() {
|
public org.hibernate.orm.test.annotations.cascade.circle.sequence.B getB() {
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setB(org.hibernate.test.annotations.cascade.circle.sequence.B parameter) {
|
public void setB(org.hibernate.orm.test.annotations.cascade.circle.sequence.B parameter) {
|
||||||
this.b = parameter;
|
this.b = parameter;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.circle.sequence;
|
package org.hibernate.orm.test.annotations.cascade.circle.sequence;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.circle.sequence;
|
package org.hibernate.orm.test.annotations.cascade.circle.sequence;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Documentation
|
* No Documentation
|
||||||
|
@ -19,7 +19,7 @@ public class D extends AbstractEntity {
|
||||||
@javax.persistence.ManyToMany(cascade = {
|
@javax.persistence.ManyToMany(cascade = {
|
||||||
javax.persistence.CascadeType.MERGE, javax.persistence.CascadeType.PERSIST, javax.persistence.CascadeType.REFRESH}
|
javax.persistence.CascadeType.MERGE, javax.persistence.CascadeType.PERSIST, javax.persistence.CascadeType.REFRESH}
|
||||||
)
|
)
|
||||||
private java.util.Set<org.hibernate.test.annotations.cascade.circle.sequence.A> aCollection = new java.util.HashSet<org.hibernate.test.annotations.cascade.circle.sequence.A>();
|
private java.util.Set<org.hibernate.orm.test.annotations.cascade.circle.sequence.A> aCollection = new java.util.HashSet<org.hibernate.orm.test.annotations.cascade.circle.sequence.A>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No documentation
|
* No documentation
|
||||||
|
@ -29,12 +29,12 @@ public class D extends AbstractEntity {
|
||||||
)
|
)
|
||||||
private java.util.Set<E> eCollection = new java.util.HashSet<E>();
|
private java.util.Set<E> eCollection = new java.util.HashSet<E>();
|
||||||
|
|
||||||
public java.util.Set<org.hibernate.test.annotations.cascade.circle.sequence.A> getACollection() {
|
public java.util.Set<org.hibernate.orm.test.annotations.cascade.circle.sequence.A> getACollection() {
|
||||||
return aCollection;
|
return aCollection;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setACollection(
|
public void setACollection(
|
||||||
java.util.Set<org.hibernate.test.annotations.cascade.circle.sequence.A> parameter) {
|
java.util.Set<org.hibernate.orm.test.annotations.cascade.circle.sequence.A> parameter) {
|
||||||
this.aCollection = parameter;
|
this.aCollection = parameter;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.circle.sequence;
|
package org.hibernate.orm.test.annotations.cascade.circle.sequence;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Documentation
|
* No Documentation
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.circle.sequence;
|
package org.hibernate.orm.test.annotations.cascade.circle.sequence;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Documentation
|
* No Documentation
|
||||||
|
@ -19,7 +19,7 @@ public class F extends AbstractEntity {
|
||||||
@javax.persistence.OneToMany(cascade = {
|
@javax.persistence.OneToMany(cascade = {
|
||||||
javax.persistence.CascadeType.MERGE, javax.persistence.CascadeType.PERSIST, javax.persistence.CascadeType.REFRESH}
|
javax.persistence.CascadeType.MERGE, javax.persistence.CascadeType.PERSIST, javax.persistence.CascadeType.REFRESH}
|
||||||
, mappedBy = "f")
|
, mappedBy = "f")
|
||||||
private java.util.Set<org.hibernate.test.annotations.cascade.circle.sequence.B> bCollection = new java.util.HashSet<org.hibernate.test.annotations.cascade.circle.sequence.B>();
|
private java.util.Set<org.hibernate.orm.test.annotations.cascade.circle.sequence.B> bCollection = new java.util.HashSet<org.hibernate.orm.test.annotations.cascade.circle.sequence.B>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No documentation
|
* No documentation
|
||||||
|
@ -29,12 +29,12 @@ public class F extends AbstractEntity {
|
||||||
)
|
)
|
||||||
private H h;
|
private H h;
|
||||||
|
|
||||||
public java.util.Set<org.hibernate.test.annotations.cascade.circle.sequence.B> getBCollection() {
|
public java.util.Set<org.hibernate.orm.test.annotations.cascade.circle.sequence.B> getBCollection() {
|
||||||
return bCollection;
|
return bCollection;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBCollection(
|
public void setBCollection(
|
||||||
java.util.Set<org.hibernate.test.annotations.cascade.circle.sequence.B> parameter) {
|
java.util.Set<org.hibernate.orm.test.annotations.cascade.circle.sequence.B> parameter) {
|
||||||
this.bCollection = parameter;
|
this.bCollection = parameter;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.circle.sequence;
|
package org.hibernate.orm.test.annotations.cascade.circle.sequence;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Documentation
|
* No Documentation
|
||||||
|
@ -19,14 +19,14 @@ public class G extends AbstractEntity {
|
||||||
@javax.persistence.OneToMany(cascade = {
|
@javax.persistence.OneToMany(cascade = {
|
||||||
javax.persistence.CascadeType.MERGE, javax.persistence.CascadeType.PERSIST, javax.persistence.CascadeType.REFRESH}
|
javax.persistence.CascadeType.MERGE, javax.persistence.CascadeType.PERSIST, javax.persistence.CascadeType.REFRESH}
|
||||||
, mappedBy = "g")
|
, mappedBy = "g")
|
||||||
private java.util.Set<org.hibernate.test.annotations.cascade.circle.sequence.C> cCollection = new java.util.HashSet<org.hibernate.test.annotations.cascade.circle.sequence.C>();
|
private java.util.Set<org.hibernate.orm.test.annotations.cascade.circle.sequence.C> cCollection = new java.util.HashSet<org.hibernate.orm.test.annotations.cascade.circle.sequence.C>();
|
||||||
|
|
||||||
public java.util.Set<org.hibernate.test.annotations.cascade.circle.sequence.C> getCCollection() {
|
public java.util.Set<org.hibernate.orm.test.annotations.cascade.circle.sequence.C> getCCollection() {
|
||||||
return cCollection;
|
return cCollection;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCCollection(
|
public void setCCollection(
|
||||||
java.util.Set<org.hibernate.test.annotations.cascade.circle.sequence.C> parameter) {
|
java.util.Set<org.hibernate.orm.test.annotations.cascade.circle.sequence.C> parameter) {
|
||||||
this.cCollection = parameter;
|
this.cCollection = parameter;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.circle.sequence;
|
package org.hibernate.orm.test.annotations.cascade.circle.sequence;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Documentation
|
* No Documentation
|
||||||
|
@ -19,13 +19,13 @@ public class H extends AbstractEntity {
|
||||||
@javax.persistence.OneToOne(cascade = {
|
@javax.persistence.OneToOne(cascade = {
|
||||||
javax.persistence.CascadeType.MERGE, javax.persistence.CascadeType.PERSIST, javax.persistence.CascadeType.REFRESH}
|
javax.persistence.CascadeType.MERGE, javax.persistence.CascadeType.PERSIST, javax.persistence.CascadeType.REFRESH}
|
||||||
)
|
)
|
||||||
private org.hibernate.test.annotations.cascade.circle.sequence.G g;
|
private org.hibernate.orm.test.annotations.cascade.circle.sequence.G g;
|
||||||
|
|
||||||
public org.hibernate.test.annotations.cascade.circle.sequence.G getG() {
|
public org.hibernate.orm.test.annotations.cascade.circle.sequence.G getG() {
|
||||||
return g;
|
return g;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setG(org.hibernate.test.annotations.cascade.circle.sequence.G parameter) {
|
public void setG(org.hibernate.orm.test.annotations.cascade.circle.sequence.G parameter) {
|
||||||
this.g = parameter;
|
this.g = parameter;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.multicircle.nonjpa.identity;
|
package org.hibernate.orm.test.annotations.cascade.multicircle.jpa.identity;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.multicircle.jpa.identity;
|
package org.hibernate.orm.test.annotations.cascade.multicircle.jpa.identity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Documentation
|
* No Documentation
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.multicircle.jpa.identity;
|
package org.hibernate.orm.test.annotations.cascade.multicircle.jpa.identity;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.multicircle.jpa.identity;
|
package org.hibernate.orm.test.annotations.cascade.multicircle.jpa.identity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Documentation
|
* No Documentation
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.multicircle.jpa.identity;
|
package org.hibernate.orm.test.annotations.cascade.multicircle.jpa.identity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Documentation
|
* No Documentation
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.multicircle.jpa.identity;
|
package org.hibernate.orm.test.annotations.cascade.multicircle.jpa.identity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Documentation
|
* No Documentation
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.multicircle.jpa.identity;
|
package org.hibernate.orm.test.annotations.cascade.multicircle.jpa.identity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Documentation
|
* No Documentation
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.multicircle.jpa.identity;
|
package org.hibernate.orm.test.annotations.cascade.multicircle.jpa.identity;
|
||||||
|
|
||||||
import junit.framework.Assert;
|
import junit.framework.Assert;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.multicircle.nonjpa.sequence;
|
package org.hibernate.orm.test.annotations.cascade.multicircle.jpa.sequence;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.multicircle.jpa.sequence;
|
package org.hibernate.orm.test.annotations.cascade.multicircle.jpa.sequence;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Documentation
|
* No Documentation
|
||||||
|
@ -19,7 +19,7 @@ public class B extends AbstractEntity {
|
||||||
@javax.persistence.OneToMany(cascade = {
|
@javax.persistence.OneToMany(cascade = {
|
||||||
javax.persistence.CascadeType.MERGE, javax.persistence.CascadeType.PERSIST, javax.persistence.CascadeType.REFRESH}
|
javax.persistence.CascadeType.MERGE, javax.persistence.CascadeType.PERSIST, javax.persistence.CascadeType.REFRESH}
|
||||||
, mappedBy = "b")
|
, mappedBy = "b")
|
||||||
private java.util.Set<G> gCollection = new java.util.HashSet<org.hibernate.test.annotations.cascade.multicircle.jpa.sequence.G>();
|
private java.util.Set<G> gCollection = new java.util.HashSet<org.hibernate.orm.test.annotations.cascade.multicircle.jpa.sequence.G>();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.multicircle.jpa.sequence;
|
package org.hibernate.orm.test.annotations.cascade.multicircle.jpa.sequence;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.multicircle.jpa.sequence;
|
package org.hibernate.orm.test.annotations.cascade.multicircle.jpa.sequence;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Documentation
|
* No Documentation
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.multicircle.nonjpa.sequence;
|
package org.hibernate.orm.test.annotations.cascade.multicircle.jpa.sequence;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Documentation
|
* No Documentation
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.multicircle.jpa.sequence;
|
package org.hibernate.orm.test.annotations.cascade.multicircle.jpa.sequence;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Documentation
|
* No Documentation
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.multicircle.jpa.sequence;
|
package org.hibernate.orm.test.annotations.cascade.multicircle.jpa.sequence;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Documentation
|
* No Documentation
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.multicircle.jpa.sequence;
|
package org.hibernate.orm.test.annotations.cascade.multicircle.jpa.sequence;
|
||||||
|
|
||||||
import org.hibernate.Session;
|
import org.hibernate.Session;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.multicircle.jpa.identity;
|
package org.hibernate.orm.test.annotations.cascade.multicircle.nonjpa.identity;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.multicircle.nonjpa.identity;
|
package org.hibernate.orm.test.annotations.cascade.multicircle.nonjpa.identity;
|
||||||
|
|
||||||
@javax.persistence.Entity
|
@javax.persistence.Entity
|
||||||
public class EntityB extends AbstractEntity {
|
public class EntityB extends AbstractEntity {
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.multicircle.nonjpa.identity;
|
package org.hibernate.orm.test.annotations.cascade.multicircle.nonjpa.identity;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.multicircle.nonjpa.identity;
|
package org.hibernate.orm.test.annotations.cascade.multicircle.nonjpa.identity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Documentation
|
* No Documentation
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.multicircle.nonjpa.identity;
|
package org.hibernate.orm.test.annotations.cascade.multicircle.nonjpa.identity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Documentation
|
* No Documentation
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.multicircle.nonjpa.identity;
|
package org.hibernate.orm.test.annotations.cascade.multicircle.nonjpa.identity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Documentation
|
* No Documentation
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.multicircle.nonjpa.identity;
|
package org.hibernate.orm.test.annotations.cascade.multicircle.nonjpa.identity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Documentation
|
* No Documentation
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.multicircle.nonjpa.identity;
|
package org.hibernate.orm.test.annotations.cascade.multicircle.nonjpa.identity;
|
||||||
|
|
||||||
import junit.framework.Assert;
|
import junit.framework.Assert;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.multicircle.jpa.sequence;
|
package org.hibernate.orm.test.annotations.cascade.multicircle.nonjpa.sequence;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.multicircle.nonjpa.sequence;
|
package org.hibernate.orm.test.annotations.cascade.multicircle.nonjpa.sequence;
|
||||||
|
|
||||||
@javax.persistence.Entity
|
@javax.persistence.Entity
|
||||||
public class B extends AbstractEntity {
|
public class B extends AbstractEntity {
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.multicircle.nonjpa.sequence;
|
package org.hibernate.orm.test.annotations.cascade.multicircle.nonjpa.sequence;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.multicircle.nonjpa.sequence;
|
package org.hibernate.orm.test.annotations.cascade.multicircle.nonjpa.sequence;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Documentation
|
* No Documentation
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.multicircle.jpa.sequence;
|
package org.hibernate.orm.test.annotations.cascade.multicircle.nonjpa.sequence;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Documentation
|
* No Documentation
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.multicircle.nonjpa.sequence;
|
package org.hibernate.orm.test.annotations.cascade.multicircle.nonjpa.sequence;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Documentation
|
* No Documentation
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.multicircle.nonjpa.sequence;
|
package org.hibernate.orm.test.annotations.cascade.multicircle.nonjpa.sequence;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Documentation
|
* No Documentation
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.cascade.multicircle.nonjpa.sequence;
|
package org.hibernate.orm.test.annotations.cascade.multicircle.nonjpa.sequence;
|
||||||
|
|
||||||
import org.hibernate.Session;
|
import org.hibernate.Session;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.keymanytoone.bidir.component;
|
package org.hibernate.orm.test.keymanytoone.bidir.component;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
association.
|
association.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<hibernate-mapping package="org.hibernate.test.keymanytoone.bidir.component">
|
<hibernate-mapping package="org.hibernate.orm.test.keymanytoone.bidir.component">
|
||||||
|
|
||||||
<class name="Customer" table="COMP_LAZY_KM2O_CUST">
|
<class name="Customer" table="COMP_LAZY_KM2O_CUST">
|
||||||
<id name="id" column="ID" type="long">
|
<id name="id" column="ID" type="long">
|
|
@ -0,0 +1,111 @@
|
||||||
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
|
*/
|
||||||
|
package org.hibernate.orm.test.keymanytoone.bidir.component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.hibernate.stat.spi.StatisticsImplementor;
|
||||||
|
|
||||||
|
import org.hibernate.testing.orm.junit.DomainModel;
|
||||||
|
import org.hibernate.testing.orm.junit.SessionFactory;
|
||||||
|
import org.hibernate.testing.orm.junit.SessionFactoryScope;
|
||||||
|
import org.junit.jupiter.api.AfterEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Steve Ebersole
|
||||||
|
*/
|
||||||
|
@DomainModel(xmlMappings = {
|
||||||
|
"org/hibernate/orm/test/keymanytoone/bidir/component/EagerCollectionLazyKeyManyToOneMapping.hbm.xml"
|
||||||
|
})
|
||||||
|
@SessionFactory(generateStatistics = true)
|
||||||
|
public class EagerCollectionLazyKeyManyToOneTest {
|
||||||
|
|
||||||
|
@AfterEach
|
||||||
|
public void tearDown(SessionFactoryScope scope) {
|
||||||
|
scope.inTransaction(
|
||||||
|
session -> {
|
||||||
|
List<Customer> customers = session.createQuery( "from Customer" ).list();
|
||||||
|
customers.forEach(
|
||||||
|
customer -> session.delete( customer )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testQueryingOnMany2One(SessionFactoryScope scope) {
|
||||||
|
Customer cust = new Customer( "Acme, Inc." );
|
||||||
|
Order order = new Order( new Order.Id( cust, 1 ) );
|
||||||
|
cust.getOrders().add( order );
|
||||||
|
|
||||||
|
scope.inTransaction(
|
||||||
|
session -> {
|
||||||
|
session.save( cust );
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
scope.inTransaction(
|
||||||
|
session -> {
|
||||||
|
List results = session.createQuery( "from Order o where o.id.customer.name = :name" )
|
||||||
|
.setParameter( "name", cust.getName() )
|
||||||
|
.list();
|
||||||
|
assertEquals( 1, results.size() );
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSaveCascadedToKeyManyToOne(SessionFactoryScope scope) {
|
||||||
|
// test cascading a save to an association with a key-many-to-one which refers to a
|
||||||
|
// just saved entity
|
||||||
|
StatisticsImplementor statistics = scope.getSessionFactory().getStatistics();
|
||||||
|
scope.inTransaction(
|
||||||
|
session -> {
|
||||||
|
Customer cust = new Customer( "Acme, Inc." );
|
||||||
|
Order order = new Order( new Order.Id( cust, 1 ) );
|
||||||
|
cust.getOrders().add( order );
|
||||||
|
statistics.clear();
|
||||||
|
session.save( cust );
|
||||||
|
session.flush();
|
||||||
|
|
||||||
|
assertEquals( 2, statistics.getEntityInsertCount() );
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testLoadingStrategies(SessionFactoryScope scope) {
|
||||||
|
|
||||||
|
Customer customer = new Customer( "Acme, Inc." );
|
||||||
|
Order order = new Order( new Order.Id( customer, 1 ) );
|
||||||
|
customer.getOrders().add( order );
|
||||||
|
|
||||||
|
scope.inTransaction(
|
||||||
|
session -> session.save( customer )
|
||||||
|
);
|
||||||
|
|
||||||
|
scope.inTransaction(
|
||||||
|
session -> {
|
||||||
|
Customer cust = session.get( Customer.class, customer.getId() );
|
||||||
|
assertEquals( 1, cust.getOrders().size() );
|
||||||
|
session.clear();
|
||||||
|
|
||||||
|
cust = (Customer) session.createQuery( "from Customer" ).uniqueResult();
|
||||||
|
assertEquals( 1, cust.getOrders().size() );
|
||||||
|
session.clear();
|
||||||
|
|
||||||
|
cust = (Customer) session.createQuery( "from Customer c join fetch c.orders" ).uniqueResult();
|
||||||
|
assertEquals( 1, cust.getOrders().size() );
|
||||||
|
session.clear();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,17 +4,14 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.keymanytoone.bidir.component;
|
package org.hibernate.orm.test.keymanytoone.bidir.component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import javax.persistence.criteria.CriteriaBuilder;
|
import javax.persistence.criteria.CriteriaBuilder;
|
||||||
import javax.persistence.criteria.CriteriaQuery;
|
import javax.persistence.criteria.CriteriaQuery;
|
||||||
|
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
import org.hibernate.Session;
|
|
||||||
import org.hibernate.boot.Metadata;
|
import org.hibernate.boot.Metadata;
|
||||||
import org.hibernate.boot.registry.BootstrapServiceRegistryBuilder;
|
|
||||||
import org.hibernate.cfg.Configuration;
|
|
||||||
import org.hibernate.cfg.Environment;
|
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.event.internal.DefaultLoadEventListener;
|
import org.hibernate.event.internal.DefaultLoadEventListener;
|
||||||
import org.hibernate.event.service.spi.EventListenerRegistry;
|
import org.hibernate.event.service.spi.EventListenerRegistry;
|
||||||
|
@ -23,35 +20,31 @@ import org.hibernate.event.spi.LoadEvent;
|
||||||
import org.hibernate.event.spi.LoadEventListener;
|
import org.hibernate.event.spi.LoadEventListener;
|
||||||
import org.hibernate.integrator.spi.Integrator;
|
import org.hibernate.integrator.spi.Integrator;
|
||||||
import org.hibernate.service.spi.SessionFactoryServiceRegistry;
|
import org.hibernate.service.spi.SessionFactoryServiceRegistry;
|
||||||
|
import org.hibernate.stat.spi.StatisticsImplementor;
|
||||||
|
|
||||||
import org.hibernate.testing.TestForIssue;
|
import org.hibernate.testing.TestForIssue;
|
||||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
import org.hibernate.testing.orm.junit.DomainModel;
|
||||||
import org.junit.Test;
|
import org.hibernate.testing.orm.junit.ServiceRegistry;
|
||||||
|
import org.hibernate.testing.orm.junit.SessionFactory;
|
||||||
|
import org.hibernate.testing.orm.junit.SessionFactoryScope;
|
||||||
|
import org.junit.jupiter.api.AfterEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.fail;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.junit.Assert.fail;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings( {"unchecked"})
|
@DomainModel(xmlMappings = {
|
||||||
public class EagerKeyManyToOneTest extends BaseCoreFunctionalTestCase {
|
"org/hibernate/orm/test/keymanytoone/bidir/component/EagerMapping.hbm.xml"
|
||||||
@Override
|
})
|
||||||
public String[] getMappings() {
|
@SessionFactory(generateStatistics = true)
|
||||||
return new String[] { "keymanytoone/bidir/component/EagerMapping.hbm.xml" };
|
@ServiceRegistry(integrators = EagerKeyManyToOneTest.CustomLoadIntegrator.class)
|
||||||
}
|
public class EagerKeyManyToOneTest {
|
||||||
|
|
||||||
@Override
|
public static class CustomLoadIntegrator implements Integrator {
|
||||||
public void configure(Configuration cfg) {
|
|
||||||
super.configure( cfg );
|
|
||||||
cfg.setProperty( Environment.GENERATE_STATISTICS, "true" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void prepareBootstrapRegistryBuilder(BootstrapServiceRegistryBuilder builder) {
|
|
||||||
super.prepareBootstrapRegistryBuilder( builder );
|
|
||||||
builder.applyIntegrator(
|
|
||||||
new Integrator() {
|
|
||||||
@Override
|
@Override
|
||||||
public void integrate(
|
public void integrate(
|
||||||
Metadata metadata,
|
Metadata metadata,
|
||||||
|
@ -72,33 +65,44 @@ public class EagerKeyManyToOneTest extends BaseCoreFunctionalTestCase {
|
||||||
SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
|
SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@AfterEach
|
||||||
|
public void tearDown(SessionFactoryScope scope) {
|
||||||
|
scope.inTransaction(
|
||||||
|
session -> {
|
||||||
|
List<Customer> customers = session.createQuery( "from Customer" ).list();
|
||||||
|
customers.forEach(
|
||||||
|
customer -> session.delete( customer )
|
||||||
|
);
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSaveCascadedToKeyManyToOne() {
|
public void testSaveCascadedToKeyManyToOne(SessionFactoryScope scope) {
|
||||||
sessionFactory().getStatistics().clear();
|
StatisticsImplementor statistics = scope.getSessionFactory().getStatistics();
|
||||||
|
statistics.clear();
|
||||||
|
|
||||||
// test cascading a save to an association with a key-many-to-one which refers to a
|
// test cascading a save to an association with a key-many-to-one which refers to a
|
||||||
// just saved entity
|
// just saved entity
|
||||||
inTransaction(
|
scope.inTransaction(
|
||||||
s -> {
|
s -> {
|
||||||
Customer cust = new Customer( "Acme, Inc." );
|
Customer cust = new Customer( "Acme, Inc." );
|
||||||
Order order = new Order( new Order.Id( cust, 1 ) );
|
Order order = new Order( new Order.Id( cust, 1 ) );
|
||||||
cust.getOrders().add( order );
|
cust.getOrders().add( order );
|
||||||
s.save( cust );
|
s.save( cust );
|
||||||
s.flush();
|
s.flush();
|
||||||
assertEquals( 2, sessionFactory().getStatistics().getEntityInsertCount() );
|
assertEquals( 2, statistics.getEntityInsertCount() );
|
||||||
s.delete( cust );
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLoadingStrategies() {
|
public void testLoadingStrategies(SessionFactoryScope scope) {
|
||||||
sessionFactory().getStatistics().clear();
|
StatisticsImplementor statistics = scope.getSessionFactory().getStatistics();
|
||||||
|
statistics.clear();
|
||||||
|
|
||||||
inTransaction(
|
scope.inTransaction(
|
||||||
s -> {
|
s -> {
|
||||||
Customer cust = new Customer( "Acme, Inc." );
|
Customer cust = new Customer( "Acme, Inc." );
|
||||||
Order order = new Order( new Order.Id( cust, 1 ) );
|
Order order = new Order( new Order.Id( cust, 1 ) );
|
||||||
|
@ -107,17 +111,18 @@ public class EagerKeyManyToOneTest extends BaseCoreFunctionalTestCase {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
inTransaction(
|
scope.inTransaction(
|
||||||
s -> {
|
s -> {
|
||||||
Customer cust = ( Customer ) s.createQuery( "from Customer" ).uniqueResult();
|
Customer cust = (Customer) s.createQuery( "from Customer" ).uniqueResult();
|
||||||
assertEquals( 1, cust.getOrders().size() );
|
assertEquals( 1, cust.getOrders().size() );
|
||||||
s.clear();
|
s.clear();
|
||||||
|
|
||||||
cust = ( Customer ) s.createQuery( "from Customer c join fetch c.orders" ).uniqueResult();
|
cust = (Customer) s.createQuery( "from Customer c join fetch c.orders" ).uniqueResult();
|
||||||
assertEquals( 1, cust.getOrders().size() );
|
assertEquals( 1, cust.getOrders().size() );
|
||||||
s.clear();
|
s.clear();
|
||||||
|
|
||||||
cust = ( Customer ) s.createQuery( "from Customer c join fetch c.orders as o join fetch o.id.customer" ).uniqueResult();
|
cust = (Customer) s.createQuery( "from Customer c join fetch c.orders as o join fetch o.id.customer" )
|
||||||
|
.uniqueResult();
|
||||||
assertEquals( 1, cust.getOrders().size() );
|
assertEquals( 1, cust.getOrders().size() );
|
||||||
s.clear();
|
s.clear();
|
||||||
|
|
||||||
|
@ -127,16 +132,15 @@ public class EagerKeyManyToOneTest extends BaseCoreFunctionalTestCase {
|
||||||
cust = s.createQuery( criteria ).uniqueResult();
|
cust = s.createQuery( criteria ).uniqueResult();
|
||||||
assertEquals( 1, cust.getOrders().size() );
|
assertEquals( 1, cust.getOrders().size() );
|
||||||
s.clear();
|
s.clear();
|
||||||
|
|
||||||
s.delete( cust );
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestForIssue( jiraKey = "HHH-2277")
|
@TestForIssue(jiraKey = "HHH-2277")
|
||||||
public void testLoadEntityWithEagerFetchingToKeyManyToOneReferenceBackToSelf() {
|
public void testLoadEntityWithEagerFetchingToKeyManyToOneReferenceBackToSelf(SessionFactoryScope scope) {
|
||||||
sessionFactory().getStatistics().clear();
|
StatisticsImplementor statistics = scope.getSessionFactory().getStatistics();
|
||||||
|
statistics.clear();
|
||||||
|
|
||||||
// long winded method name to say that this is a test specifically for HHH-2277 ;)
|
// long winded method name to say that this is a test specifically for HHH-2277 ;)
|
||||||
// essentially we have a bidirectional association where one side of the
|
// essentially we have a bidirectional association where one side of the
|
||||||
|
@ -150,26 +154,23 @@ public class EagerKeyManyToOneTest extends BaseCoreFunctionalTestCase {
|
||||||
// into the persistence context for the association with the
|
// into the persistence context for the association with the
|
||||||
// composite key because we are in the process of trying to build
|
// composite key because we are in the process of trying to build
|
||||||
// the composite-id instance
|
// the composite-id instance
|
||||||
Session s = openSession();
|
Customer customer = new Customer( "Acme, Inc." );
|
||||||
s.beginTransaction();
|
Order order = new Order( new Order.Id( customer, 1 ) );
|
||||||
Customer cust = new Customer( "Acme, Inc." );
|
customer.getOrders().add( order );
|
||||||
Order order = new Order( new Order.Id( cust, 1 ) );
|
scope.inTransaction(
|
||||||
cust.getOrders().add( order );
|
session -> session.save( customer )
|
||||||
s.save( cust );
|
);
|
||||||
s.getTransaction().commit();
|
|
||||||
s.close();
|
|
||||||
|
|
||||||
s = openSession();
|
scope.inTransaction(
|
||||||
s.beginTransaction();
|
session -> {
|
||||||
try {
|
try {
|
||||||
cust = ( Customer ) s.get( Customer.class, cust.getId() );
|
session.get( Customer.class, customer.getId() );
|
||||||
}
|
}
|
||||||
catch( OverflowCondition overflow ) {
|
catch (OverflowCondition overflow) {
|
||||||
fail( "get()/load() caused overflow condition" );
|
fail( "get()/load() caused overflow condition" );
|
||||||
}
|
}
|
||||||
s.delete( cust );
|
}
|
||||||
s.getTransaction().commit();
|
);
|
||||||
s.close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class OverflowCondition extends RuntimeException {
|
private static class OverflowCondition extends RuntimeException {
|
||||||
|
@ -177,6 +178,7 @@ public class EagerKeyManyToOneTest extends BaseCoreFunctionalTestCase {
|
||||||
|
|
||||||
private static class CustomLoadListener extends DefaultLoadEventListener {
|
private static class CustomLoadListener extends DefaultLoadEventListener {
|
||||||
private int internalLoadCount = 0;
|
private int internalLoadCount = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoad(LoadEvent event, LoadType loadType) throws HibernateException {
|
public void onLoad(LoadEvent event, LoadType loadType) throws HibernateException {
|
||||||
if ( LoadEventListener.INTERNAL_LOAD_EAGER.getName().equals( loadType.getName() ) ) {
|
if ( LoadEventListener.INTERNAL_LOAD_EAGER.getName().equals( loadType.getName() ) ) {
|
|
@ -18,7 +18,7 @@
|
||||||
association.
|
association.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<hibernate-mapping package="org.hibernate.test.keymanytoone.bidir.component">
|
<hibernate-mapping package="org.hibernate.orm.test.keymanytoone.bidir.component">
|
||||||
|
|
||||||
<class name="Customer" table="COMP_LAZY_KM2O_CUST">
|
<class name="Customer" table="COMP_LAZY_KM2O_CUST">
|
||||||
<id name="id" column="ID" type="long">
|
<id name="id" column="ID" type="long">
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
</composite-id>
|
</composite-id>
|
||||||
<set name="items" table="COMP_LAZY_KM2O_ITEM">
|
<set name="items" table="COMP_LAZY_KM2O_ITEM">
|
||||||
<key>
|
<key>
|
||||||
<column name="CUST_ID"/>
|
<column name="CUSTOMER_ID"/>
|
||||||
<column name="ORDER_NUM"/>
|
<column name="ORDER_NUM"/>
|
||||||
</key>
|
</key>
|
||||||
<element type="string" column="ITEM_DESC" />
|
<element type="string" column="ITEM_DESC" />
|
|
@ -0,0 +1,110 @@
|
||||||
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
|
*/
|
||||||
|
package org.hibernate.orm.test.keymanytoone.bidir.component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.hibernate.stat.spi.StatisticsImplementor;
|
||||||
|
|
||||||
|
import org.hibernate.testing.orm.junit.DomainModel;
|
||||||
|
import org.hibernate.testing.orm.junit.SessionFactory;
|
||||||
|
import org.hibernate.testing.orm.junit.SessionFactoryScope;
|
||||||
|
import org.junit.jupiter.api.AfterEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Steve Ebersole
|
||||||
|
*/
|
||||||
|
@DomainModel(xmlMappings = {
|
||||||
|
"org/hibernate/orm/test/keymanytoone/bidir/component/LazyMapping.hbm.xml"
|
||||||
|
})
|
||||||
|
@SessionFactory(generateStatistics = true)
|
||||||
|
public class LazyKeyManyToOneTest {
|
||||||
|
|
||||||
|
@AfterEach
|
||||||
|
public void tearDown(SessionFactoryScope scope) {
|
||||||
|
scope.inTransaction(
|
||||||
|
session -> {
|
||||||
|
List<Customer> customers = session.createQuery( "from Customer" ).list();
|
||||||
|
customers.forEach(
|
||||||
|
customer -> session.delete( customer )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testQueryingOnMany2One(SessionFactoryScope scope) {
|
||||||
|
Customer cust = new Customer( "Acme, Inc." );
|
||||||
|
Order order = new Order( new Order.Id( cust, 1 ) );
|
||||||
|
cust.getOrders().add( order );
|
||||||
|
|
||||||
|
scope.inTransaction(
|
||||||
|
session -> session.save( cust )
|
||||||
|
);
|
||||||
|
|
||||||
|
scope.inTransaction(
|
||||||
|
session -> {
|
||||||
|
List results = session.createQuery( "from Order o where o.id.customer.name = :name" )
|
||||||
|
.setParameter( "name", cust.getName() )
|
||||||
|
.list();
|
||||||
|
assertEquals( 1, results.size() );
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSaveCascadedToKeyManyToOne(SessionFactoryScope scope) {
|
||||||
|
// test cascading a save to an association with a key-many-to-one which refers to a
|
||||||
|
// just saved entity
|
||||||
|
StatisticsImplementor statistics = scope.getSessionFactory().getStatistics();
|
||||||
|
|
||||||
|
scope.inTransaction(
|
||||||
|
session -> {
|
||||||
|
Customer cust = new Customer( "Acme, Inc." );
|
||||||
|
Order order = new Order( new Order.Id( cust, 1 ) );
|
||||||
|
cust.getOrders().add( order );
|
||||||
|
statistics.clear();
|
||||||
|
session.save( cust );
|
||||||
|
session.flush();
|
||||||
|
assertEquals( 2, statistics.getEntityInsertCount() );
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testLoadingStrategies(SessionFactoryScope scope) {
|
||||||
|
|
||||||
|
Customer customer = new Customer( "Acme, Inc." );
|
||||||
|
Order order = new Order( new Order.Id( customer, 1 ) );
|
||||||
|
customer.getOrders().add( order );
|
||||||
|
|
||||||
|
scope.inTransaction(
|
||||||
|
session -> session.save( customer )
|
||||||
|
);
|
||||||
|
|
||||||
|
scope.inTransaction(
|
||||||
|
session -> {
|
||||||
|
Customer cust = session.get( Customer.class, customer.getId() );
|
||||||
|
assertEquals( 1, cust.getOrders().size() );
|
||||||
|
session.clear();
|
||||||
|
|
||||||
|
cust = (Customer) session.createQuery( "from Customer" ).uniqueResult();
|
||||||
|
assertEquals( 1, cust.getOrders().size() );
|
||||||
|
session.clear();
|
||||||
|
|
||||||
|
cust = (Customer) session.createQuery( "from Customer c join fetch c.orders" ).uniqueResult();
|
||||||
|
assertEquals( 1, cust.getOrders().size() );
|
||||||
|
session.clear();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -18,7 +18,7 @@
|
||||||
association.
|
association.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<hibernate-mapping package="org.hibernate.test.keymanytoone.bidir.component">
|
<hibernate-mapping package="org.hibernate.orm.test.keymanytoone.bidir.component">
|
||||||
|
|
||||||
<class name="Customer" table="COMP_LAZY_KM2O_CUST">
|
<class name="Customer" table="COMP_LAZY_KM2O_CUST">
|
||||||
<id name="id" column="ID" type="long">
|
<id name="id" column="ID" type="long">
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.keymanytoone.bidir.component;
|
package org.hibernate.orm.test.keymanytoone.bidir.component;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.keymanytoone.unidir.ondelete;
|
package org.hibernate.orm.test.keymanytoone.unidir.ondelete;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
|
@ -0,0 +1,91 @@
|
||||||
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
|
*/
|
||||||
|
package org.hibernate.orm.test.keymanytoone.unidir.ondelete;
|
||||||
|
|
||||||
|
import org.hibernate.testing.TestForIssue;
|
||||||
|
import org.hibernate.testing.orm.junit.DialectFeatureChecks;
|
||||||
|
import org.hibernate.testing.orm.junit.DomainModel;
|
||||||
|
import org.hibernate.testing.orm.junit.RequiresDialectFeature;
|
||||||
|
import org.hibernate.testing.orm.junit.SessionFactory;
|
||||||
|
import org.hibernate.testing.orm.junit.SessionFactoryScope;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com)
|
||||||
|
*/
|
||||||
|
@RequiresDialectFeature(feature = DialectFeatureChecks.SupportsCascadeDeleteCheck.class)
|
||||||
|
@DomainModel(xmlMappings = {
|
||||||
|
"org/hibernate/orm/test/keymanytoone/unidir/ondelete/Mapping.hbm.xml"
|
||||||
|
})
|
||||||
|
@SessionFactory
|
||||||
|
public class KeyManyToOneCascadeDeleteTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestForIssue(jiraKey = "HHH-7807")
|
||||||
|
public void testComponentCascadeRemoval(SessionFactoryScope scope) {
|
||||||
|
scope.inSession(
|
||||||
|
session -> {
|
||||||
|
Customer customer = new Customer( "Lukasz" );
|
||||||
|
Order order1 = new Order( new Order.Id( customer, 1L ) );
|
||||||
|
order1.setItem( "laptop" );
|
||||||
|
Order order2 = new Order( new Order.Id( customer, 2L ) );
|
||||||
|
order2.setItem( "printer" );
|
||||||
|
session.getTransaction().begin();
|
||||||
|
try {
|
||||||
|
session.save( customer );
|
||||||
|
session.save( order1 );
|
||||||
|
session.save( order2 );
|
||||||
|
session.getTransaction().commit();
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
if ( session.getTransaction().isActive() ) {
|
||||||
|
session.getTransaction().rollback();
|
||||||
|
}
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Removing customer cascades to associated orders.
|
||||||
|
session.getTransaction().begin();
|
||||||
|
try {
|
||||||
|
customer = session.get( Customer.class, customer.getId() );
|
||||||
|
session.delete( customer );
|
||||||
|
session.getTransaction().commit();
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
if ( session.getTransaction().isActive() ) {
|
||||||
|
session.getTransaction().rollback();
|
||||||
|
}
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
|
session.getTransaction().begin();
|
||||||
|
try {
|
||||||
|
assertEquals(
|
||||||
|
"0",
|
||||||
|
session.createQuery( "select count(*) from Customer" )
|
||||||
|
.uniqueResult()
|
||||||
|
.toString()
|
||||||
|
);
|
||||||
|
assertEquals(
|
||||||
|
"0",
|
||||||
|
session.createQuery( "select count(*) from Order" ).uniqueResult().toString()
|
||||||
|
);
|
||||||
|
session.getTransaction().commit();
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
if ( session.getTransaction().isActive() ) {
|
||||||
|
session.getTransaction().rollback();
|
||||||
|
}
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,7 +16,7 @@
|
||||||
of the composition is a foreign-key to another entity.
|
of the composition is a foreign-key to another entity.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<hibernate-mapping package="org.hibernate.test.keymanytoone.unidir.ondelete">
|
<hibernate-mapping package="org.hibernate.orm.test.keymanytoone.unidir.ondelete">
|
||||||
|
|
||||||
<class name="Customer" table="CUSTOMERS">
|
<class name="Customer" table="CUSTOMERS">
|
||||||
<id name="id" column="ID" type="long">
|
<id name="id" column="ID" type="long">
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.keymanytoone.unidir.ondelete;
|
package org.hibernate.orm.test.keymanytoone.unidir.ondelete;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
|
@ -1,110 +0,0 @@
|
||||||
/*
|
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
|
||||||
*
|
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
|
||||||
*/
|
|
||||||
package org.hibernate.test.keymanytoone.bidir.component;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.hibernate.Session;
|
|
||||||
import org.hibernate.cfg.Configuration;
|
|
||||||
import org.hibernate.cfg.Environment;
|
|
||||||
|
|
||||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Steve Ebersole
|
|
||||||
*/
|
|
||||||
public class EagerCollectionLazyKeyManyToOneTest extends BaseCoreFunctionalTestCase {
|
|
||||||
@Override
|
|
||||||
public String[] getMappings() {
|
|
||||||
return new String[] { "keymanytoone/bidir/component/EagerCollectionLazyKeyManyToOneMapping.hbm.xml" };
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void configure(Configuration cfg) {
|
|
||||||
super.configure( cfg );
|
|
||||||
cfg.setProperty( Environment.GENERATE_STATISTICS, "true" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testQueryingOnMany2One() {
|
|
||||||
Session s = openSession();
|
|
||||||
s.beginTransaction();
|
|
||||||
Customer cust = new Customer( "Acme, Inc." );
|
|
||||||
Order order = new Order( new Order.Id( cust, 1 ) );
|
|
||||||
cust.getOrders().add( order );
|
|
||||||
s.save( cust );
|
|
||||||
s.getTransaction().commit();
|
|
||||||
s.close();
|
|
||||||
|
|
||||||
s = openSession();
|
|
||||||
s.beginTransaction();
|
|
||||||
List results = s.createQuery( "from Order o where o.id.customer.name = :name" )
|
|
||||||
.setParameter( "name", cust.getName() )
|
|
||||||
.list();
|
|
||||||
assertEquals( 1, results.size() );
|
|
||||||
s.getTransaction().commit();
|
|
||||||
s.close();
|
|
||||||
|
|
||||||
s = openSession();
|
|
||||||
s.beginTransaction();
|
|
||||||
s.delete( cust );
|
|
||||||
s.getTransaction().commit();
|
|
||||||
s.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSaveCascadedToKeyManyToOne() {
|
|
||||||
// test cascading a save to an association with a key-many-to-one which refers to a
|
|
||||||
// just saved entity
|
|
||||||
Session s = openSession();
|
|
||||||
s.beginTransaction();
|
|
||||||
Customer cust = new Customer( "Acme, Inc." );
|
|
||||||
Order order = new Order( new Order.Id( cust, 1 ) );
|
|
||||||
cust.getOrders().add( order );
|
|
||||||
sessionFactory().getStatistics().clear();
|
|
||||||
s.save( cust );
|
|
||||||
s.flush();
|
|
||||||
assertEquals( 2, sessionFactory().getStatistics().getEntityInsertCount() );
|
|
||||||
s.delete( cust );
|
|
||||||
s.getTransaction().commit();
|
|
||||||
s.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testLoadingStrategies() {
|
|
||||||
Session s = openSession();
|
|
||||||
s.beginTransaction();
|
|
||||||
Customer cust = new Customer( "Acme, Inc." );
|
|
||||||
Order order = new Order( new Order.Id( cust, 1 ) );
|
|
||||||
cust.getOrders().add( order );
|
|
||||||
s.save( cust );
|
|
||||||
s.getTransaction().commit();
|
|
||||||
s.close();
|
|
||||||
|
|
||||||
s = openSession();
|
|
||||||
s.beginTransaction();
|
|
||||||
|
|
||||||
cust = ( Customer ) s.get( Customer.class, cust.getId() );
|
|
||||||
assertEquals( 1, cust.getOrders().size() );
|
|
||||||
s.clear();
|
|
||||||
|
|
||||||
cust = ( Customer ) s.createQuery( "from Customer" ).uniqueResult();
|
|
||||||
assertEquals( 1, cust.getOrders().size() );
|
|
||||||
s.clear();
|
|
||||||
|
|
||||||
cust = ( Customer ) s.createQuery( "from Customer c join fetch c.orders" ).uniqueResult();
|
|
||||||
assertEquals( 1, cust.getOrders().size() );
|
|
||||||
s.clear();
|
|
||||||
|
|
||||||
s.delete( cust );
|
|
||||||
s.getTransaction().commit();
|
|
||||||
s.close();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,109 +0,0 @@
|
||||||
/*
|
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
|
||||||
*
|
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
|
||||||
*/
|
|
||||||
package org.hibernate.test.keymanytoone.bidir.component;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import org.hibernate.Session;
|
|
||||||
import org.hibernate.cfg.Configuration;
|
|
||||||
import org.hibernate.cfg.Environment;
|
|
||||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Steve Ebersole
|
|
||||||
*/
|
|
||||||
public class LazyKeyManyToOneTest extends BaseCoreFunctionalTestCase {
|
|
||||||
@Override
|
|
||||||
public String[] getMappings() {
|
|
||||||
return new String[] { "keymanytoone/bidir/component/LazyMapping.hbm.xml" };
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void configure(Configuration cfg) {
|
|
||||||
super.configure( cfg );
|
|
||||||
cfg.setProperty( Environment.GENERATE_STATISTICS, "true" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testQueryingOnMany2One() {
|
|
||||||
Session s = openSession();
|
|
||||||
s.beginTransaction();
|
|
||||||
Customer cust = new Customer( "Acme, Inc." );
|
|
||||||
Order order = new Order( new Order.Id( cust, 1 ) );
|
|
||||||
cust.getOrders().add( order );
|
|
||||||
s.save( cust );
|
|
||||||
s.getTransaction().commit();
|
|
||||||
s.close();
|
|
||||||
|
|
||||||
s = openSession();
|
|
||||||
s.beginTransaction();
|
|
||||||
List results = s.createQuery( "from Order o where o.id.customer.name = :name" )
|
|
||||||
.setParameter( "name", cust.getName() )
|
|
||||||
.list();
|
|
||||||
assertEquals( 1, results.size() );
|
|
||||||
s.getTransaction().commit();
|
|
||||||
s.close();
|
|
||||||
|
|
||||||
s = openSession();
|
|
||||||
s.beginTransaction();
|
|
||||||
s.delete( cust );
|
|
||||||
s.getTransaction().commit();
|
|
||||||
s.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSaveCascadedToKeyManyToOne() {
|
|
||||||
// test cascading a save to an association with a key-many-to-one which refers to a
|
|
||||||
// just saved entity
|
|
||||||
Session s = openSession();
|
|
||||||
s.beginTransaction();
|
|
||||||
Customer cust = new Customer( "Acme, Inc." );
|
|
||||||
Order order = new Order( new Order.Id( cust, 1 ) );
|
|
||||||
cust.getOrders().add( order );
|
|
||||||
sessionFactory().getStatistics().clear();
|
|
||||||
s.save( cust );
|
|
||||||
s.flush();
|
|
||||||
assertEquals( 2, sessionFactory().getStatistics().getEntityInsertCount() );
|
|
||||||
s.delete( cust );
|
|
||||||
s.getTransaction().commit();
|
|
||||||
s.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testLoadingStrategies() {
|
|
||||||
Session s = openSession();
|
|
||||||
s.beginTransaction();
|
|
||||||
Customer cust = new Customer( "Acme, Inc." );
|
|
||||||
Order order = new Order( new Order.Id( cust, 1 ) );
|
|
||||||
cust.getOrders().add( order );
|
|
||||||
s.save( cust );
|
|
||||||
s.getTransaction().commit();
|
|
||||||
s.close();
|
|
||||||
|
|
||||||
s = openSession();
|
|
||||||
s.beginTransaction();
|
|
||||||
|
|
||||||
cust = ( Customer ) s.get( Customer.class, cust.getId() );
|
|
||||||
assertEquals( 1, cust.getOrders().size() );
|
|
||||||
s.clear();
|
|
||||||
|
|
||||||
cust = ( Customer ) s.createQuery( "from Customer" ).uniqueResult();
|
|
||||||
assertEquals( 1, cust.getOrders().size() );
|
|
||||||
s.clear();
|
|
||||||
|
|
||||||
cust = ( Customer ) s.createQuery( "from Customer c join fetch c.orders" ).uniqueResult();
|
|
||||||
assertEquals( 1, cust.getOrders().size() );
|
|
||||||
s.clear();
|
|
||||||
|
|
||||||
s.delete( cust );
|
|
||||||
s.getTransaction().commit();
|
|
||||||
s.close();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,58 +0,0 @@
|
||||||
/*
|
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
|
||||||
*
|
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
|
||||||
*/
|
|
||||||
package org.hibernate.test.keymanytoone.unidir.ondelete;
|
|
||||||
|
|
||||||
import org.hibernate.Session;
|
|
||||||
|
|
||||||
import org.junit.Assert;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import org.hibernate.testing.DialectChecks;
|
|
||||||
import org.hibernate.testing.RequiresDialectFeature;
|
|
||||||
import org.hibernate.testing.TestForIssue;
|
|
||||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com)
|
|
||||||
*/
|
|
||||||
@RequiresDialectFeature(DialectChecks.SupportsCascadeDeleteCheck.class)
|
|
||||||
public class KeyManyToOneCascadeDeleteTest extends BaseCoreFunctionalTestCase {
|
|
||||||
@Override
|
|
||||||
public String[] getMappings() {
|
|
||||||
return new String[] { "keymanytoone/unidir/ondelete/Mapping.hbm.xml" };
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestForIssue( jiraKey = "HHH-7807" )
|
|
||||||
public void testComponentCascadeRemoval() {
|
|
||||||
Session session = openSession();
|
|
||||||
|
|
||||||
session.getTransaction().begin();
|
|
||||||
Customer customer = new Customer( "Lukasz" );
|
|
||||||
Order order1 = new Order( new Order.Id( customer, 1L ) );
|
|
||||||
order1.setItem( "laptop" );
|
|
||||||
Order order2 = new Order( new Order.Id( customer, 2L ) );
|
|
||||||
order2.setItem( "printer" );
|
|
||||||
session.save( customer );
|
|
||||||
session.save( order1 );
|
|
||||||
session.save( order2 );
|
|
||||||
session.getTransaction().commit();
|
|
||||||
|
|
||||||
// Removing customer cascades to associated orders.
|
|
||||||
session.getTransaction().begin();
|
|
||||||
customer = (Customer) session.get( Customer.class, customer.getId() );
|
|
||||||
session.delete( customer );
|
|
||||||
session.getTransaction().commit();
|
|
||||||
|
|
||||||
session.getTransaction().begin();
|
|
||||||
Assert.assertEquals( "0", session.createQuery( "select count(*) from Customer" ).uniqueResult().toString() );
|
|
||||||
Assert.assertEquals( "0", session.createQuery( "select count(*) from Order" ).uniqueResult().toString() );
|
|
||||||
session.getTransaction().commit();
|
|
||||||
|
|
||||||
session.close();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -14,6 +14,7 @@ import java.lang.annotation.Target;
|
||||||
|
|
||||||
import org.hibernate.boot.registry.StandardServiceInitiator;
|
import org.hibernate.boot.registry.StandardServiceInitiator;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
|
import org.hibernate.integrator.spi.Integrator;
|
||||||
import org.hibernate.service.spi.ServiceContributor;
|
import org.hibernate.service.spi.ServiceContributor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -76,6 +77,8 @@ public @interface ServiceRegistry {
|
||||||
|
|
||||||
Class<? extends StandardServiceInitiator>[] initiators() default {};
|
Class<? extends StandardServiceInitiator>[] initiators() default {};
|
||||||
|
|
||||||
|
Class<? extends Integrator>[] integrators() default {};
|
||||||
|
|
||||||
Service[] services() default {};
|
Service[] services() default {};
|
||||||
|
|
||||||
Setting[] settings() default {};
|
Setting[] settings() default {};
|
||||||
|
|
|
@ -6,11 +6,15 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.testing.orm.junit;
|
package org.hibernate.testing.orm.junit;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import org.hibernate.boot.registry.BootstrapServiceRegistryBuilder;
|
||||||
import org.hibernate.boot.registry.StandardServiceInitiator;
|
import org.hibernate.boot.registry.StandardServiceInitiator;
|
||||||
import org.hibernate.boot.registry.StandardServiceRegistry;
|
import org.hibernate.boot.registry.StandardServiceRegistry;
|
||||||
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
||||||
|
import org.hibernate.integrator.spi.Integrator;
|
||||||
import org.hibernate.service.spi.ServiceContributor;
|
import org.hibernate.service.spi.ServiceContributor;
|
||||||
|
|
||||||
import org.junit.jupiter.api.extension.AfterAllCallback;
|
import org.junit.jupiter.api.extension.AfterAllCallback;
|
||||||
|
@ -51,9 +55,10 @@ public class ServiceRegistryExtension
|
||||||
|
|
||||||
final ExtensionContext.Store store = locateExtensionStore( testInstance, context );
|
final ExtensionContext.Store store = locateExtensionStore( testInstance, context );
|
||||||
|
|
||||||
ServiceRegistryScopeImpl scope = (ServiceRegistryScopeImpl) store.get( REGISTRY_KEY );
|
ServiceRegistryScopeImpl existingScope = (ServiceRegistryScopeImpl) store.get( REGISTRY_KEY );
|
||||||
|
|
||||||
if ( scope == null ) {
|
if ( existingScope == null ) {
|
||||||
|
final ServiceRegistryScopeImpl scope = new ServiceRegistryScopeImpl( );
|
||||||
log.debugf( "Creating ServiceRegistryScope - %s", context.getDisplayName() );
|
log.debugf( "Creating ServiceRegistryScope - %s", context.getDisplayName() );
|
||||||
|
|
||||||
final ServiceRegistryProducer producer;
|
final ServiceRegistryProducer producer;
|
||||||
|
@ -75,22 +80,34 @@ public class ServiceRegistryExtension
|
||||||
if ( serviceRegistryAnnWrapper.isPresent() ) {
|
if ( serviceRegistryAnnWrapper.isPresent() ) {
|
||||||
final ServiceRegistry serviceRegistryAnn = serviceRegistryAnnWrapper.get();
|
final ServiceRegistry serviceRegistryAnn = serviceRegistryAnnWrapper.get();
|
||||||
configureServices( serviceRegistryAnn, ssrb );
|
configureServices( serviceRegistryAnn, ssrb );
|
||||||
|
configureIntegrators(serviceRegistryAnn, scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ssrb.build();
|
return ssrb.build();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
scope = new ServiceRegistryScopeImpl( producer );
|
|
||||||
|
|
||||||
|
scope.createRegistry(producer);
|
||||||
|
|
||||||
locateExtensionStore( testInstance, context ).put( REGISTRY_KEY, scope );
|
locateExtensionStore( testInstance, context ).put( REGISTRY_KEY, scope );
|
||||||
|
|
||||||
if ( testInstance instanceof ServiceRegistryScopeAware ) {
|
if ( testInstance instanceof ServiceRegistryScopeAware ) {
|
||||||
( (ServiceRegistryScopeAware) testInstance ).injectServiceRegistryScope( scope );
|
( (ServiceRegistryScopeAware) testInstance ).injectServiceRegistryScope( scope );
|
||||||
}
|
}
|
||||||
|
return scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
return scope;
|
return existingScope;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void configureIntegrators(
|
||||||
|
ServiceRegistry serviceRegistryAnn,
|
||||||
|
final ServiceRegistryScopeImpl serviceRegistryScope) {
|
||||||
|
for ( Class<? extends Integrator> integrator : serviceRegistryAnn.integrators() ) {
|
||||||
|
serviceRegistryScope.applyIntegrator( integrator );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void configureServices(ServiceRegistry serviceRegistryAnn, StandardServiceRegistryBuilder ssrb) {
|
private static void configureServices(ServiceRegistry serviceRegistryAnn, StandardServiceRegistryBuilder ssrb) {
|
||||||
|
@ -154,21 +171,32 @@ public class ServiceRegistryExtension
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class ServiceRegistryScopeImpl implements ServiceRegistryScope, ExtensionContext.Store.CloseableResource {
|
private static class ServiceRegistryScopeImpl implements ServiceRegistryScope, ExtensionContext.Store.CloseableResource {
|
||||||
private final ServiceRegistryProducer producer;
|
private ServiceRegistryProducer producer;
|
||||||
|
|
||||||
private StandardServiceRegistry registry;
|
private StandardServiceRegistry registry;
|
||||||
private boolean active = true;
|
private boolean active = true;
|
||||||
|
private List<Class<? extends Integrator>> integrators = new ArrayList<>();
|
||||||
|
|
||||||
public ServiceRegistryScopeImpl(ServiceRegistryProducer producer) {
|
public ServiceRegistryScopeImpl() {
|
||||||
this.producer = producer;
|
|
||||||
|
|
||||||
this.registry = createRegistry();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private StandardServiceRegistry createRegistry() {
|
public StandardServiceRegistry createRegistry(ServiceRegistryProducer producer) {
|
||||||
|
this.producer = producer;
|
||||||
verifyActive();
|
verifyActive();
|
||||||
|
BootstrapServiceRegistryBuilder bootstrapServiceRegistryBuilder = new BootstrapServiceRegistryBuilder().enableAutoClose();
|
||||||
|
integrators.forEach(
|
||||||
|
integrator -> {
|
||||||
|
try {
|
||||||
|
bootstrapServiceRegistryBuilder.applyIntegrator( integrator.newInstance() );
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
throw new RuntimeException( "Could not configure BootstrapServiceRegistryBuilder", e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
final StandardServiceRegistryBuilder ssrb = new StandardServiceRegistryBuilder();
|
final StandardServiceRegistryBuilder ssrb = new StandardServiceRegistryBuilder(bootstrapServiceRegistryBuilder.build());
|
||||||
// we will close it ourselves explicitly.
|
// we will close it ourselves explicitly.
|
||||||
ssrb.disableAutoClose();
|
ssrb.disableAutoClose();
|
||||||
|
|
||||||
|
@ -181,12 +209,16 @@ public class ServiceRegistryExtension
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void applyIntegrator(Class<? extends Integrator> integrator) {
|
||||||
|
integrators.add( integrator );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StandardServiceRegistry getRegistry() {
|
public StandardServiceRegistry getRegistry() {
|
||||||
verifyActive();
|
verifyActive();
|
||||||
|
|
||||||
if ( registry == null ) {
|
if ( registry == null ) {
|
||||||
registry = createRegistry();
|
registry = createRegistry( producer );
|
||||||
}
|
}
|
||||||
|
|
||||||
return registry;
|
return registry;
|
||||||
|
|
|
@ -85,7 +85,6 @@ public class SessionFactoryExtension
|
||||||
producer = model -> {
|
producer = model -> {
|
||||||
try {
|
try {
|
||||||
final SessionFactoryBuilder sessionFactoryBuilder = model.getSessionFactoryBuilder();
|
final SessionFactoryBuilder sessionFactoryBuilder = model.getSessionFactoryBuilder();
|
||||||
|
|
||||||
if ( StringHelper.isNotEmpty( sessionFactoryConfig.sessionFactoryName() ) ) {
|
if ( StringHelper.isNotEmpty( sessionFactoryConfig.sessionFactoryName() ) ) {
|
||||||
sessionFactoryBuilder.applyName( sessionFactoryConfig.sessionFactoryName() );
|
sessionFactoryBuilder.applyName( sessionFactoryConfig.sessionFactoryName() );
|
||||||
}
|
}
|
||||||
|
@ -156,6 +155,7 @@ public class SessionFactoryExtension
|
||||||
|
|
||||||
final StandardServiceRegistry serviceRegistry = model.getMetadataBuildingOptions().getServiceRegistry();
|
final StandardServiceRegistry serviceRegistry = model.getMetadataBuildingOptions().getServiceRegistry();
|
||||||
|
|
||||||
|
|
||||||
SchemaManagementToolCoordinator.process(
|
SchemaManagementToolCoordinator.process(
|
||||||
model,
|
model,
|
||||||
serviceRegistry,
|
serviceRegistry,
|
||||||
|
|
Loading…
Reference in New Issue