Remove use of session#save, session#saveOrUpdate , session#update and session#remove from tests

This commit is contained in:
Andrea Boriero 2024-07-25 09:49:45 +02:00 committed by Steve Ebersole
parent edfd5a66e4
commit 34d6715815
41 changed files with 103 additions and 107 deletions

View File

@ -33,8 +33,8 @@ public class Father {
@OneToMany
@OrderColumn(name = "son_arriv")
@JoinColumn(name = "father_id", nullable = false)
@Cascade({ CascadeType.SAVE_UPDATE })
@Cascade({ CascadeType.PERSIST, CascadeType.MERGE })
public List<Son> getOrderedSons() { return orderedSons; }
public void setOrderedSons(List<Son> orderedSons) { this.orderedSons = orderedSons; }
private List<Son> orderedSons = new ArrayList<Son>( );
private List<Son> orderedSons = new ArrayList<>( );
}

View File

@ -29,8 +29,8 @@ public class Mother {
private Integer id;
@OneToMany(mappedBy = "mother")
@Cascade({ CascadeType.SAVE_UPDATE })
@Cascade({ CascadeType.PERSIST, CascadeType.MERGE })
public Set<Son> getSons() { return sons; }
public void setSons(Set<Son> sons) { this.sons = sons; }
private Set<Son> sons = new HashSet<Son>();
private Set<Son> sons = new HashSet<>();
}

View File

@ -42,10 +42,10 @@ public class CompositeIdTest {
public void tearDown(SessionFactoryScope scope) {
scope.inTransaction(
session -> {
session.createQuery( "delete from LineItem" ).executeUpdate();
session.createQuery( "delete from Order" ).executeUpdate();
session.createQuery( "delete from Customer" ).executeUpdate();
session.createQuery( "delete from Product" ).executeUpdate();
session.createMutationQuery( "delete from LineItem" ).executeUpdate();
session.createMutationQuery( "delete from Order" ).executeUpdate();
session.createMutationQuery( "delete from Customer" ).executeUpdate();
session.createMutationQuery( "delete from Product" ).executeUpdate();
}
);
}
@ -54,7 +54,7 @@ public class CompositeIdTest {
public void testQuery(SessionFactoryScope scope) {
scope.inTransaction(
session ->
session.createQuery( "from LineItem ol where ol.order.id.customerId = 'C111'" ).list()
session.createQuery( "from LineItem ol where ol.order.id.customerId = 'C111'", LineItem.class ).list()
);
}
@ -63,13 +63,13 @@ public class CompositeIdTest {
Product p = new Product();
p.setProductId( "A123" );
p.setDescription( "nipple ring" );
p.setPrice( new BigDecimal( 1.0 ) );
p.setPrice( new BigDecimal( "1.0" ) );
p.setNumberAvailable( 1004 );
Product p2 = new Product();
p2.setProductId( "X525" );
p2.setDescription( "nose stud" );
p2.setPrice( new BigDecimal( 3.0 ) );
p2.setPrice( new BigDecimal( "3.0" ) );
p2.setNumberAvailable( 105 );
scope.inTransaction(
@ -161,12 +161,10 @@ public class CompositeIdTest {
statementInspector.clear();
session.flush();
statementInspector.assertExecutedCount( 4 );
statementInspector.assertIsSelect( 0 );
statementInspector.assertNumberOfOccurrenceInQuery( 0, "join", 0 );
statementInspector.assertIsInsert( 1 );
statementInspector.assertExecutedCount( 3 );
statementInspector.assertIsInsert( 0 );
statementInspector.assertIsUpdate( 1 );
statementInspector.assertIsUpdate( 2 );
statementInspector.assertIsUpdate( 3 );
statementInspector.clear();
@ -174,12 +172,10 @@ public class CompositeIdTest {
li2.setQuantity( 5 );
List bigOrders = session.createQuery( "from Order o where o.total>10.0" ).list();
statementInspector.assertExecutedCount( 3 );
statementInspector.assertIsSelect( 0 );
statementInspector.assertNumberOfOccurrenceInQuery( 0, "join", 0 );
statementInspector.assertIsInsert( 1 );
statementInspector.assertIsSelect( 2 );
statementInspector.assertNumberOfOccurrenceInQuery( 2, "join", 0 );
statementInspector.assertExecutedCount( 2 );
statementInspector.assertIsInsert( 0 );
statementInspector.assertIsSelect( 1 );
statementInspector.assertNumberOfOccurrenceInQuery( 1, "join", 0 );
assertEquals( bigOrders.size(), 1 );
}
@ -193,14 +189,14 @@ public class CompositeIdTest {
Product p = new Product();
p.setProductId( "A123" );
p.setDescription( "nipple ring" );
p.setPrice( new BigDecimal( 1.0 ) );
p.setPrice( new BigDecimal( "1.0" ) );
p.setNumberAvailable( 1004 );
session.persist( p );
Product p2 = new Product();
p2.setProductId( "X525" );
p2.setDescription( "nose stud" );
p2.setPrice( new BigDecimal( 3.0 ) );
p2.setPrice( new BigDecimal( "3.0" ) );
p2.setNumberAvailable( 105 );
session.persist( p2 );
@ -239,7 +235,7 @@ public class CompositeIdTest {
scope.inTransaction(
session -> {
Order o = (Order) session.createQuery( "from Order o" ).uniqueResult();
Order o = session.createQuery( "from Order o", Order.class ).uniqueResult();
assertTrue( Hibernate.isInitialized( o.getLineItems() ) );
LineItem li = (LineItem) o.getLineItems().iterator().next();
assertTrue( Hibernate.isInitialized( li ) );
@ -255,14 +251,14 @@ public class CompositeIdTest {
Product p = new Product();
p.setProductId( "A123" );
p.setDescription( "nipple ring" );
p.setPrice( new BigDecimal( 1.0 ) );
p.setPrice( new BigDecimal( "1.0" ) );
p.setNumberAvailable( 1004 );
session.persist( p );
Product p2 = new Product();
p2.setProductId( "X525" );
p2.setDescription( "nose stud" );
p2.setPrice( new BigDecimal( 3.0 ) );
p2.setPrice( new BigDecimal( "3.0" ) );
p2.setNumberAvailable( 105 );
session.persist( p2 );

View File

@ -49,9 +49,9 @@ public abstract class AbstractManyToManyAssociationClassTest {
protected void cleanupTest(SessionFactoryScope scope) {
scope.inTransaction(
session -> {
session.createQuery( "delete from " + membership.getClass().getName() );
session.createQuery( "delete from User" );
session.createQuery( "delete from Group" );
session.createMutationQuery( "delete from " + membership.getClass().getName() ).executeUpdate();
session.createMutationQuery( "delete from User" ).executeUpdate();
session.createMutationQuery( "delete from Group" ).executeUpdate();
}
);
}
@ -129,8 +129,8 @@ public abstract class AbstractManyToManyAssociationClassTest {
public void testRemoveAndAddEqualCollection(SessionFactoryScope scope) {
deleteMembership( user, group, membership );
membership = createMembership( "membership" );
user.setMemberships( new HashSet() );
group.setMemberships( new HashSet() );
user.setMemberships( new HashSet<>() );
group.setMemberships( new HashSet<>() );
addMembership( user, group, membership );
scope.inTransaction(

View File

@ -14,7 +14,7 @@ import java.util.Set;
public class Group {
private Long id;
private String name;
private Set memberships = new HashSet();
private Set<Membership> memberships = new HashSet<>();
public Group() {
}
@ -39,11 +39,11 @@ public class Group {
this.name = name;
}
public Set getMemberships() {
public Set<Membership> getMemberships() {
return memberships;
}
public void setMemberships(Set memberships) {
public void setMemberships(Set<Membership> memberships) {
this.memberships = memberships;
}

View File

@ -14,7 +14,7 @@ import java.util.Set;
public class User {
private Long id;
private String name;
private Set memberships = new HashSet();
private Set<Membership> memberships = new HashSet<>();
public User() {
}
@ -39,11 +39,11 @@ public class User {
this.name = name;
}
public Set getMemberships() {
public Set<Membership> getMemberships() {
return memberships;
}
public void setMemberships(Set memberships) {
public void setMemberships(Set<Membership> memberships) {
this.memberships = memberships;
}

View File

@ -16,7 +16,7 @@
<param name="sequence">hbmentity_id_sequence</param>
</generator>
</id>
<many-to-one name="association" cascade="persist,save-update" not-null="true"/>
<many-to-one name="association" cascade="persist,merge" not-null="true"/>
</class>
</hibernate-mapping>

View File

@ -16,11 +16,11 @@
<property name="name" type="string" not-null="true"/>
<set name="nodes" inverse="true" cascade="persist,merge,refresh,save-update">
<set name="nodes" inverse="true" cascade="persist,merge,refresh">
<key column="routeID"/>
<one-to-many class="Node"/>
</set>
<set name="vehicles" inverse="true" cascade="persist,merge,refresh,save-update">
<set name="vehicles" inverse="true" cascade="persist,merge,refresh">
<key column="routeID"/>
<one-to-many class="Vehicle"/>
</set>
@ -33,7 +33,7 @@
<property name="name" type="string" not-null="true"/>
<set name="nodes" inverse="true" lazy="true" cascade="merge,refresh,persist,save-update">
<set name="nodes" inverse="true" lazy="true" cascade="merge,refresh,persist">
<key column="tourID"/>
<one-to-many class="Node"/>
</set>
@ -50,21 +50,21 @@
column="pickupNodeID"
unique="true"
not-null="true"
cascade="merge,refresh,persist,save-update"
cascade="merge,refresh,persist"
lazy="false"/>
<many-to-one name="deliveryNode"
column="deliveryNodeID"
unique="true"
not-null="true"
cascade="merge,refresh,persist,save-update"
cascade="merge,refresh,persist"
lazy="false"/>
<many-to-one name="vehicle"
column="vehicleID"
unique="false"
not-null="true"
cascade="merge,refresh,persist,save-update"
cascade="merge,refresh,persist"
lazy="false"/>
</class>
@ -73,7 +73,7 @@
<version name="version" column="VERS" type="long" />
<property name="name"/>
<set name="transports" inverse="false" lazy="true" cascade="merge,refresh,persist,save-update">
<set name="transports" inverse="false" lazy="true" cascade="merge,refresh,persist">
<key column="vehicleID"/>
<one-to-many class="Transport" not-found="exception"/>
</set>
@ -81,7 +81,7 @@
column="routeID"
unique="false"
not-null="false"
cascade="merge,refresh,persist,save-update"
cascade="merge,refresh,persist"
lazy="false"/>
</class>
@ -93,12 +93,12 @@
<property name="name" type="string" not-null="true"/>
<set name="deliveryTransports" inverse="true" lazy="true" cascade="merge,refresh,persist,save-update">
<set name="deliveryTransports" inverse="true" lazy="true" cascade="merge,refresh,persist">
<key column="deliveryNodeID"/>
<one-to-many class="Transport"/>
</set>
<set name="pickupTransports" inverse="true" lazy="true" cascade="merge,refresh,persist,save-update">
<set name="pickupTransports" inverse="true" lazy="true" cascade="merge,refresh,persist">
<key column="pickupNodeID"/>
<one-to-many class="Transport"/>
</set>
@ -107,14 +107,14 @@
column="routeID"
unique="false"
not-null="true"
cascade="merge,refresh,persist,save-update"
cascade="merge,refresh,persist"
lazy="false"/>
<many-to-one name="tour"
column="tourID"
unique="false"
not-null="true"
cascade="merge,refresh,persist,save-update"
cascade="merge,refresh,persist"
lazy="false"/>
</class>

View File

@ -32,7 +32,7 @@
<list name="orders"
inverse="true"
cascade="save-update">
cascade="persist, merge">
<key column="customerId"/>
<index column="orderNumber"/>
<one-to-many class="Order"/>

View File

@ -59,7 +59,7 @@
fetch="join"
lazy="false"
inverse="true"
cascade="save-update">
cascade="persist, merge">
<key>
<column name="customerId"/>
<column name="orderNumber"/>

View File

@ -15,7 +15,7 @@
<id name="id" type="long">
<generator class="native" />
</id>
<list name="animals" cascade="save-update,delete">
<list name="animals" cascade="persist, merge ,delete">
<key column="Zoo_id" not-null="true" />
<list-index column="list_index" />
<one-to-many class="Animal" not-found="ignore" />
@ -28,7 +28,7 @@
</id>
<discriminator column="discriminator" type="string" />
<property name="name"/>
<many-to-one name="zoo" class="Zoo" cascade="save-update,delete" />
<many-to-one name="zoo" class="Zoo" cascade="merge,persist,delete" />
</class>
<subclass name="Mammal" discriminator-value="MAMMAL" extends="Animal">

View File

@ -24,7 +24,7 @@
<many-to-one name="user"
class="User"
cascade="save-update"
cascade="merge,persist"
column="userid"
not-null="true"
property-ref="userid"/>

View File

@ -24,7 +24,7 @@
<many-to-one name="user"
class="User"
cascade="save-update"
cascade="merge,persist"
column="userid"
not-null="true"
property-ref="userid"/>

View File

@ -17,7 +17,7 @@
<generator class="uuid.hex" />
</id>
<map name="children" lazy="extra" inverse="true" cascade="save-update">
<map name="children" lazy="extra" inverse="true" cascade="persist, merge">
<key column="PARENT_ID" />
<map-key type="string" formula="firstName"/>
<one-to-many class="Child" />

View File

@ -29,7 +29,7 @@
<id name="name"/>
<property name="password" column="`password`"/>
<map name="session" lazy="extra"
cascade="persist,save-update,delete,delete-orphan">
cascade="persist,merge,delete,delete-orphan">
<key column="userName" not-null="true"/>
<map-key column="name" type="string"/>
<one-to-many class="SessionAttribute"/>

View File

@ -32,7 +32,7 @@
</id>
<property name="name" column="NAME" type="string"/>
<component name="code" class="Course$Code">
<many-to-one name="department" class="Department" column="DEPT_ID" cascade="save-update"/>
<many-to-one name="department" class="Department" column="DEPT_ID" cascade="merge,persist"/>
<property name="number" type="int" column="CODE_NUMBER"/>
</component>
<fetch-profile name="course.details">

View File

@ -18,7 +18,7 @@
<property name="name" column="REG" type="string"/>
<set name="salespersons" cascade="save-update" inverse="true">
<set name="salespersons" cascade="merge,persist" inverse="true">
<key column="DEPT_ID"/>
<one-to-many class="Salesperson"/>
<filter name="seniorSalespersons"><![CDATA[`hire dt` < :asOfDate]]></filter>

View File

@ -26,7 +26,7 @@
<key column="SIMPLE_1_ID"/>
<one-to-many class="SimpleAssociatedEntity"/>
</set>
<set name="manyToManyAssociatedEntities" cascade="save-update" inverse="false" lazy="true" table="MANY_TO_MANY">
<set name="manyToManyAssociatedEntities" cascade="merge, persist" inverse="false" lazy="true" table="MANY_TO_MANY">
<key column="IN_ID"/>
<many-to-many class="SimpleEntityWithAssociation" column="OUT_ID"/>
</set>

View File

@ -16,7 +16,7 @@
<id name="id" column="PART_ID" type="long">
<generator class="increment"/>
</id>
<many-to-one name="item" class="Item" column="ITEM_ID" cascade="save-update, persist, lock" not-null="true"/>
<many-to-one name="item" class="Item" column="ITEM_ID" cascade="merge,persist,lock" not-null="true"/>
<property name="name" column="NAME" not-null="true" type="string"/>
<property name="stockNumber" column="STOCK_NUM" not-null="true" type="string"/>
<property name="unitPrice" column="UNIT_PRICE" not-null="true" type="big_decimal"/>

View File

@ -16,7 +16,7 @@
</id>
<discriminator column="clazz_discriminata" type="integer" force="true" not-null="false"/>
<property name="name"/>
<many-to-one name="forward" class="org.hibernate.orm.test.legacy.E" cascade="save-update" />
<many-to-one name="forward" class="org.hibernate.orm.test.legacy.E" cascade="merge,persist" />
<subclass name="org.hibernate.orm.test.legacy.B" discriminator-value="null" lazy="true">
<property name="count" column="count_"/>
@ -58,7 +58,7 @@
<generator class="increment"/>
</id>
<property name="amount"/>
<one-to-one name="reverse" class="org.hibernate.orm.test.legacy.A" property-ref="forward" cascade="save-update"/>
<one-to-one name="reverse" class="org.hibernate.orm.test.legacy.A" property-ref="forward" cascade="merge,persist"/>
<set name="as" lazy="true">
<key column="e"/>
<one-to-many class="org.hibernate.orm.test.legacy.A"/>

View File

@ -236,12 +236,12 @@
<one-to-many class="org.hibernate.orm.test.legacy.Sortable"/>
</set>
<bag name="parts" lazy="true" cascade="save-update">
<bag name="parts" lazy="true" cascade="merge,persist">
<key column="baz"/>
<one-to-many class="org.hibernate.orm.test.legacy.Part"/>
</bag>
<bag name="moreParts" lazy="true" cascade="save-update">
<bag name="moreParts" lazy="true" cascade="merge,persist">
<key column="baz"/>
<many-to-many column="part" class="org.hibernate.orm.test.legacy.Part"/>
</bag>

View File

@ -19,7 +19,7 @@
<generator class="native"/>
</id>
<list name="subcategories" lazy="true" cascade="save-update,merge,delete,lock">
<list name="subcategories" lazy="true" cascade="persist,merge,delete,lock">
<!--cache-->
<key column="parent"/>
<index column="ord"/>

View File

@ -8,7 +8,7 @@
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping default-lazy="false" default-cascade="save-update">
<hibernate-mapping default-lazy="false" default-cascade="merge,persist">
<class name="org.hibernate.orm.test.legacy.Circular" dynamic-update="true">
<id name="id" column="id_" length="64" unsaved-value="null">

View File

@ -34,9 +34,9 @@
<composite-element class="org.hibernate.orm.test.legacy.ComponentNotNullRoot$ContainerInnerClass">
<property name="name"/>
<property name="count" column="count_"/>
<many-to-one name="simple" not-null="true" cascade="save-update"/>
<many-to-one name="one" cascade="save-update"/>
<many-to-one name="many" cascade="save-update"/>
<many-to-one name="simple" not-null="true" cascade="merge,persist"/>
<many-to-one name="one" cascade="merge,persist"/>
<many-to-one name="many" cascade="merge,persist"/>
</composite-element>
</list>
@ -46,8 +46,8 @@
<composite-element class="org.hibernate.orm.test.legacy.ComponentNotNullRoot$ContainerInnerClass">
<property name="name"/>
<property name="count" column="count_"/>
<many-to-one name="simple" cascade="save-update"/>
<many-to-one name="one" cascade="save-update"/>
<many-to-one name="simple" cascade="merge,persist"/>
<many-to-one name="one" cascade="merge,persist"/>
<nested-composite-element name="nested" class="org.hibernate.orm.test.legacy.ComponentNotNullRoot$ContainerInnerClass">
<property name="nestedproperty" not-null="true"/>
</nested-composite-element>

View File

@ -59,11 +59,11 @@
<many-to-one name="many" cascade="all" not-null="true"/>
</composite-element>
</bag>
<bag name="bag" inverse="true" cascade="save-update" table="CCBAG">
<bag name="bag" inverse="true" cascade="merge,persist" table="CCBAG">
<key column="container_id"/>
<many-to-many column="contained_id" class="org.hibernate.orm.test.legacy.Contained" outer-join="true"/>
</bag>
<bag name="lazyBag" inverse="true" lazy="true" table="LCCBAG" cascade="save-update">
<bag name="lazyBag" inverse="true" lazy="true" table="LCCBAG" cascade="merge,persist">
<!--cache usage="read-write"-->
<key column="container_id"/>
<many-to-many column="contained_id" class="org.hibernate.orm.test.legacy.Contained"/>

View File

@ -9,7 +9,7 @@
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping default-lazy="false"
default-cascade="save-update"
default-cascade="merge,persist"
package="org.hibernate.orm.test.legacy">
<class name="Eye" lazy="true">

View File

@ -18,7 +18,7 @@
</id>
<property name="name" unique="true" not-null="true"/>
<property name="type" column="type_"/>
<many-to-one name="parent" cascade="save-update"/>
<many-to-one name="parent" cascade="merge,persist"/>
<union-subclass name="J">
<property name="amount"/>
</union-subclass>

View File

@ -15,7 +15,7 @@
<generator class="increment"/>
</id>
<many-to-one name="w"
cascade="save-update"
cascade="merge,persist"
class="org.hibernate.orm.test.legacy.W"
insert="true"
update="false"

View File

@ -26,7 +26,7 @@
<generator class="increment"/>
</id>
<property name="x"/>
<one-to-one name="theX" cascade="save-update"/>
<one-to-one name="theX" cascade="merge,persist"/>
</class>
<class name="org.hibernate.orm.test.legacy.X$XX" table="xxx">
<id name="id">

View File

@ -27,7 +27,7 @@
<class name="User" table="users">
<id name="name"/>
<property name="password" column="pw"/>
<map name="session" cascade="persist,save-update,delete,delete-orphan">
<map name="session" cascade="persist,merge,delete,delete-orphan">
<key column="userName" not-null="true"/>
<map-key formula="lower(name)" type="string"/>
<one-to-many class="SessionAttribute"/>

View File

@ -33,7 +33,7 @@
<many-to-one name="billingAddress"
entity-name="BillingAddress"
cascade="persist,save-update,delete"
cascade="persist,merge,delete"
fetch="join">
<column name="billingAddressId"/>
<formula>'BILLING'</formula>
@ -41,7 +41,7 @@
<many-to-one name="shippingAddress"
entity-name="ShippingAddress"
cascade="persist,save-update,delete"
cascade="persist,merge,delete"
fetch="join">
<column name="shippingAddressId"/>
<formula>'SHIPPING'</formula>

View File

@ -34,7 +34,7 @@
</id>
<bag name="employers"
inverse="true"
cascade="persist,merge,save-update"
cascade="persist,merge"
table="EMPLOYER_EMPLOYEE">
<key column="EMPEE_ID"/>
<many-to-many class="Employer" column="EMPER_ID" />

View File

@ -20,8 +20,8 @@
<generator class="native"/>
</id>
<property name="name"/>
<many-to-one name="favoriteItem" cascade="persist,merge,save-update" />
<set name="items" cascade="persist,merge,save-update">
<many-to-one name="favoriteItem" cascade="persist,merge" />
<set name="items" cascade="persist,merge">
<key column="HOARDER_ID"/>
<one-to-many class="Item" />
</set>
@ -33,12 +33,12 @@
</id>
<version name="version"/>
<property name="name" not-null="true" />
<many-to-one name="category" cascade="persist,merge,save-update"/>
<many-to-one name="category" cascade="persist,merge"/>
<set name="colors">
<key column="itemId"/>
<element type="string" not-null="true"/>
</set>
<list name="subItemsBackref" lazy="true" cascade="persist,merge,save-update">
<list name="subItemsBackref" lazy="true" cascade="persist,merge">
<key column="parentItem" not-null="true"/>
<index column="indx"/>
<one-to-many class="SubItem"/>
@ -59,8 +59,8 @@
</id>
<version name="version" />
<property name="name" not-null="true" />
<many-to-one name="exampleItem" cascade="persist,merge,save-update" />
<set name="subCategories" lazy="true" cascade="persist,merge,save-update">
<many-to-one name="exampleItem" cascade="persist,merge" />
<set name="subCategories" lazy="true" cascade="persist,merge">
<key column="parentCategory" not-null="false"/>
<one-to-many class="SubCategory"/>
</set>

View File

@ -20,8 +20,8 @@
<generator class="native"/>
</id>
<property name="name"/>
<many-to-one name="favoriteItem" cascade="persist,merge,save-update" />
<set name="items" cascade="persist,merge,save-update">
<many-to-one name="favoriteItem" cascade="persist,merge" />
<set name="items" cascade="persist,merge">
<key column="HOARDER_ID"/>
<one-to-many class="Item" />
</set>
@ -33,12 +33,12 @@
</id>
<version name="version"/>
<property name="name" not-null="true" />
<many-to-one name="category" cascade="persist,merge,save-update"/>
<many-to-one name="category" cascade="persist,merge"/>
<set name="colors">
<key column="itemId"/>
<element type="string" not-null="true"/>
</set>
<list name="subItemsBackref" lazy="true" cascade="persist,merge,save-update,delete-orphan">
<list name="subItemsBackref" lazy="true" cascade="persist,merge,delete-orphan">
<key column="parentItem" not-null="true"/>
<index column="indx"/>
<one-to-many class="SubItem"/>
@ -59,8 +59,8 @@
</id>
<version name="version" />
<property name="name" not-null="true" />
<many-to-one name="exampleItem" cascade="persist,merge,save-update" />
<set name="subCategories" lazy="true" cascade="persist,merge,save-update,delete-orphan">
<many-to-one name="exampleItem" cascade="persist,merge" />
<set name="subCategories" lazy="true" cascade="persist,merge,delete-orphan">
<key column="parentCategory" not-null="false"/>
<one-to-many class="SubCategory"/>
</set>

View File

@ -24,11 +24,11 @@
<property name="created" not-null="true"/>
<set name="children"
inverse="true"
cascade="persist,merge,save-update,evict">
cascade="persist,merge,evict">
<key column="parent"/>
<one-to-many class="Node"/>
</set>
<set name="cascadingChildren" inverse="false" cascade="persist,merge,save-update,evict,delete">
<set name="cascadingChildren" inverse="false" cascade="persist,merge,evict,delete">
<key column="CASC_PARENT"/>
<one-to-many class="Node"/>
</set>
@ -47,7 +47,7 @@
<many-to-one name="parent" class="NumberedNode"/>
<set name="children"
inverse="true"
cascade="persist,merge,save-update">
cascade="persist,merge">
<key column="parent"/>
<one-to-many class="NumberedNode"/>
</set>

View File

@ -24,7 +24,7 @@
<many-to-one name="parent" class="VersionedEntity"/>
<set name="children"
inverse="true"
cascade="persist,merge,save-update,evict,delete">
cascade="persist,merge,evict,delete">
<key column="parent"/>
<one-to-many class="VersionedEntity"/>
</set>

View File

@ -24,7 +24,7 @@
<many-to-one name="user"
class="User"
cascade="save-update"
cascade="persist,merge"
column="userid"
not-null="true"
property-ref="userid"/>

View File

@ -17,10 +17,10 @@
</id>
<version name="version" column="VERS" type="long" />
<property name="name" column="NAME" type="string" />
<many-to-one name="parent" class="VersionedNode" cascade="persist,merge,save-update,evict,delete"/>
<many-to-one name="parent" class="VersionedNode" cascade="persist,merge,evict,delete"/>
<set name="children"
inverse="true"
cascade="persist,merge,save-update,evict,delete">
cascade="persist,merge,evict,delete">
<key column="parent"/>
<one-to-many class="VersionedNode"/>
</set>

View File

@ -14,7 +14,7 @@
<key-property column="NR_RZBK" name="num" />
<key-property column="TXT_OID" name="name" />
</composite-id>
<set cascade="persist, merge, save-update" inverse="true" lazy="false"
<set cascade="persist,merge" inverse="true" lazy="false"
name="buyers">
<key>
<column name="NR_RZBK" />
@ -32,7 +32,7 @@
<union-subclass name="CarBuyer">
<property column="PID" name="pid" update="false" />
<property column="TXT_OID_TESTB" name="sellerName" />
<many-to-one cascade="persist, merge, save-update" class="Seller"
<many-to-one cascade="persist,merge" class="Seller"
insert="false" name="seller" update="false">
<column name="NR_RZBK" />
<column name="TXT_OID_TESTB" />

View File

@ -29,7 +29,7 @@
<property name="number" type="int" column="int" not-null="true" />
<bag name="owners" cascade="save-update">
<bag name="owners" cascade="persist, merge">
<key column="ID_GARAGE" not-null="true" update="false" />
<one-to-many entity-name="Personaje"/>
</bag>

View File

@ -29,7 +29,7 @@
<property name="number" type="int" column="int" not-null="true" />
<bag name="owners" cascade="save-update">
<bag name="owners" cascade="persist, merge">
<key column="ID_GARAGE" not-null="true" update="false" />
<one-to-many entity-name="Personaje"/>
</bag>