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 @OneToMany
@OrderColumn(name = "son_arriv") @OrderColumn(name = "son_arriv")
@JoinColumn(name = "father_id", nullable = false) @JoinColumn(name = "father_id", nullable = false)
@Cascade({ CascadeType.SAVE_UPDATE }) @Cascade({ CascadeType.PERSIST, CascadeType.MERGE })
public List<Son> getOrderedSons() { return orderedSons; } public List<Son> getOrderedSons() { return orderedSons; }
public void setOrderedSons(List<Son> orderedSons) { this.orderedSons = 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; private Integer id;
@OneToMany(mappedBy = "mother") @OneToMany(mappedBy = "mother")
@Cascade({ CascadeType.SAVE_UPDATE }) @Cascade({ CascadeType.PERSIST, CascadeType.MERGE })
public Set<Son> getSons() { return sons; } public Set<Son> getSons() { return sons; }
public void setSons(Set<Son> sons) { this.sons = 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) { public void tearDown(SessionFactoryScope scope) {
scope.inTransaction( scope.inTransaction(
session -> { session -> {
session.createQuery( "delete from LineItem" ).executeUpdate(); session.createMutationQuery( "delete from LineItem" ).executeUpdate();
session.createQuery( "delete from Order" ).executeUpdate(); session.createMutationQuery( "delete from Order" ).executeUpdate();
session.createQuery( "delete from Customer" ).executeUpdate(); session.createMutationQuery( "delete from Customer" ).executeUpdate();
session.createQuery( "delete from Product" ).executeUpdate(); session.createMutationQuery( "delete from Product" ).executeUpdate();
} }
); );
} }
@ -54,7 +54,7 @@ public class CompositeIdTest {
public void testQuery(SessionFactoryScope scope) { public void testQuery(SessionFactoryScope scope) {
scope.inTransaction( scope.inTransaction(
session -> 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(); Product p = new Product();
p.setProductId( "A123" ); p.setProductId( "A123" );
p.setDescription( "nipple ring" ); p.setDescription( "nipple ring" );
p.setPrice( new BigDecimal( 1.0 ) ); p.setPrice( new BigDecimal( "1.0" ) );
p.setNumberAvailable( 1004 ); p.setNumberAvailable( 1004 );
Product p2 = new Product(); Product p2 = new Product();
p2.setProductId( "X525" ); p2.setProductId( "X525" );
p2.setDescription( "nose stud" ); p2.setDescription( "nose stud" );
p2.setPrice( new BigDecimal( 3.0 ) ); p2.setPrice( new BigDecimal( "3.0" ) );
p2.setNumberAvailable( 105 ); p2.setNumberAvailable( 105 );
scope.inTransaction( scope.inTransaction(
@ -161,12 +161,10 @@ public class CompositeIdTest {
statementInspector.clear(); statementInspector.clear();
session.flush(); session.flush();
statementInspector.assertExecutedCount( 4 ); statementInspector.assertExecutedCount( 3 );
statementInspector.assertIsSelect( 0 ); statementInspector.assertIsInsert( 0 );
statementInspector.assertNumberOfOccurrenceInQuery( 0, "join", 0 ); statementInspector.assertIsUpdate( 1 );
statementInspector.assertIsInsert( 1 );
statementInspector.assertIsUpdate( 2 ); statementInspector.assertIsUpdate( 2 );
statementInspector.assertIsUpdate( 3 );
statementInspector.clear(); statementInspector.clear();
@ -174,12 +172,10 @@ public class CompositeIdTest {
li2.setQuantity( 5 ); li2.setQuantity( 5 );
List bigOrders = session.createQuery( "from Order o where o.total>10.0" ).list(); List bigOrders = session.createQuery( "from Order o where o.total>10.0" ).list();
statementInspector.assertExecutedCount( 3 ); statementInspector.assertExecutedCount( 2 );
statementInspector.assertIsSelect( 0 ); statementInspector.assertIsInsert( 0 );
statementInspector.assertNumberOfOccurrenceInQuery( 0, "join", 0 ); statementInspector.assertIsSelect( 1 );
statementInspector.assertIsInsert( 1 ); statementInspector.assertNumberOfOccurrenceInQuery( 1, "join", 0 );
statementInspector.assertIsSelect( 2 );
statementInspector.assertNumberOfOccurrenceInQuery( 2, "join", 0 );
assertEquals( bigOrders.size(), 1 ); assertEquals( bigOrders.size(), 1 );
} }
@ -193,14 +189,14 @@ public class CompositeIdTest {
Product p = new Product(); Product p = new Product();
p.setProductId( "A123" ); p.setProductId( "A123" );
p.setDescription( "nipple ring" ); p.setDescription( "nipple ring" );
p.setPrice( new BigDecimal( 1.0 ) ); p.setPrice( new BigDecimal( "1.0" ) );
p.setNumberAvailable( 1004 ); p.setNumberAvailable( 1004 );
session.persist( p ); session.persist( p );
Product p2 = new Product(); Product p2 = new Product();
p2.setProductId( "X525" ); p2.setProductId( "X525" );
p2.setDescription( "nose stud" ); p2.setDescription( "nose stud" );
p2.setPrice( new BigDecimal( 3.0 ) ); p2.setPrice( new BigDecimal( "3.0" ) );
p2.setNumberAvailable( 105 ); p2.setNumberAvailable( 105 );
session.persist( p2 ); session.persist( p2 );
@ -239,7 +235,7 @@ public class CompositeIdTest {
scope.inTransaction( scope.inTransaction(
session -> { 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() ) ); assertTrue( Hibernate.isInitialized( o.getLineItems() ) );
LineItem li = (LineItem) o.getLineItems().iterator().next(); LineItem li = (LineItem) o.getLineItems().iterator().next();
assertTrue( Hibernate.isInitialized( li ) ); assertTrue( Hibernate.isInitialized( li ) );
@ -255,14 +251,14 @@ public class CompositeIdTest {
Product p = new Product(); Product p = new Product();
p.setProductId( "A123" ); p.setProductId( "A123" );
p.setDescription( "nipple ring" ); p.setDescription( "nipple ring" );
p.setPrice( new BigDecimal( 1.0 ) ); p.setPrice( new BigDecimal( "1.0" ) );
p.setNumberAvailable( 1004 ); p.setNumberAvailable( 1004 );
session.persist( p ); session.persist( p );
Product p2 = new Product(); Product p2 = new Product();
p2.setProductId( "X525" ); p2.setProductId( "X525" );
p2.setDescription( "nose stud" ); p2.setDescription( "nose stud" );
p2.setPrice( new BigDecimal( 3.0 ) ); p2.setPrice( new BigDecimal( "3.0" ) );
p2.setNumberAvailable( 105 ); p2.setNumberAvailable( 105 );
session.persist( p2 ); session.persist( p2 );

View File

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

View File

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

View File

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

View File

@ -16,7 +16,7 @@
<param name="sequence">hbmentity_id_sequence</param> <param name="sequence">hbmentity_id_sequence</param>
</generator> </generator>
</id> </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> </class>
</hibernate-mapping> </hibernate-mapping>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -17,7 +17,7 @@
<generator class="uuid.hex" /> <generator class="uuid.hex" />
</id> </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" /> <key column="PARENT_ID" />
<map-key type="string" formula="firstName"/> <map-key type="string" formula="firstName"/>
<one-to-many class="Child" /> <one-to-many class="Child" />

View File

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

View File

@ -32,7 +32,7 @@
</id> </id>
<property name="name" column="NAME" type="string"/> <property name="name" column="NAME" type="string"/>
<component name="code" class="Course$Code"> <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"/> <property name="number" type="int" column="CODE_NUMBER"/>
</component> </component>
<fetch-profile name="course.details"> <fetch-profile name="course.details">

View File

@ -18,7 +18,7 @@
<property name="name" column="REG" type="string"/> <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"/> <key column="DEPT_ID"/>
<one-to-many class="Salesperson"/> <one-to-many class="Salesperson"/>
<filter name="seniorSalespersons"><![CDATA[`hire dt` < :asOfDate]]></filter> <filter name="seniorSalespersons"><![CDATA[`hire dt` < :asOfDate]]></filter>

View File

@ -26,7 +26,7 @@
<key column="SIMPLE_1_ID"/> <key column="SIMPLE_1_ID"/>
<one-to-many class="SimpleAssociatedEntity"/> <one-to-many class="SimpleAssociatedEntity"/>
</set> </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"/> <key column="IN_ID"/>
<many-to-many class="SimpleEntityWithAssociation" column="OUT_ID"/> <many-to-many class="SimpleEntityWithAssociation" column="OUT_ID"/>
</set> </set>

View File

@ -16,7 +16,7 @@
<id name="id" column="PART_ID" type="long"> <id name="id" column="PART_ID" type="long">
<generator class="increment"/> <generator class="increment"/>
</id> </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="name" column="NAME" not-null="true" type="string"/>
<property name="stockNumber" column="STOCK_NUM" 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"/> <property name="unitPrice" column="UNIT_PRICE" not-null="true" type="big_decimal"/>

View File

@ -16,7 +16,7 @@
</id> </id>
<discriminator column="clazz_discriminata" type="integer" force="true" not-null="false"/> <discriminator column="clazz_discriminata" type="integer" force="true" not-null="false"/>
<property name="name"/> <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"> <subclass name="org.hibernate.orm.test.legacy.B" discriminator-value="null" lazy="true">
<property name="count" column="count_"/> <property name="count" column="count_"/>
@ -58,7 +58,7 @@
<generator class="increment"/> <generator class="increment"/>
</id> </id>
<property name="amount"/> <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"> <set name="as" lazy="true">
<key column="e"/> <key column="e"/>
<one-to-many class="org.hibernate.orm.test.legacy.A"/> <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"/> <one-to-many class="org.hibernate.orm.test.legacy.Sortable"/>
</set> </set>
<bag name="parts" lazy="true" cascade="save-update"> <bag name="parts" lazy="true" cascade="merge,persist">
<key column="baz"/> <key column="baz"/>
<one-to-many class="org.hibernate.orm.test.legacy.Part"/> <one-to-many class="org.hibernate.orm.test.legacy.Part"/>
</bag> </bag>
<bag name="moreParts" lazy="true" cascade="save-update"> <bag name="moreParts" lazy="true" cascade="merge,persist">
<key column="baz"/> <key column="baz"/>
<many-to-many column="part" class="org.hibernate.orm.test.legacy.Part"/> <many-to-many column="part" class="org.hibernate.orm.test.legacy.Part"/>
</bag> </bag>

View File

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

View File

@ -8,7 +8,7 @@
<!DOCTYPE hibernate-mapping PUBLIC <!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN" "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> "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"> <class name="org.hibernate.orm.test.legacy.Circular" dynamic-update="true">
<id name="id" column="id_" length="64" unsaved-value="null"> <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"> <composite-element class="org.hibernate.orm.test.legacy.ComponentNotNullRoot$ContainerInnerClass">
<property name="name"/> <property name="name"/>
<property name="count" column="count_"/> <property name="count" column="count_"/>
<many-to-one name="simple" not-null="true" cascade="save-update"/> <many-to-one name="simple" not-null="true" cascade="merge,persist"/>
<many-to-one name="one" cascade="save-update"/> <many-to-one name="one" cascade="merge,persist"/>
<many-to-one name="many" cascade="save-update"/> <many-to-one name="many" cascade="merge,persist"/>
</composite-element> </composite-element>
</list> </list>
@ -46,8 +46,8 @@
<composite-element class="org.hibernate.orm.test.legacy.ComponentNotNullRoot$ContainerInnerClass"> <composite-element class="org.hibernate.orm.test.legacy.ComponentNotNullRoot$ContainerInnerClass">
<property name="name"/> <property name="name"/>
<property name="count" column="count_"/> <property name="count" column="count_"/>
<many-to-one name="simple" cascade="save-update"/> <many-to-one name="simple" cascade="merge,persist"/>
<many-to-one name="one" cascade="save-update"/> <many-to-one name="one" cascade="merge,persist"/>
<nested-composite-element name="nested" class="org.hibernate.orm.test.legacy.ComponentNotNullRoot$ContainerInnerClass"> <nested-composite-element name="nested" class="org.hibernate.orm.test.legacy.ComponentNotNullRoot$ContainerInnerClass">
<property name="nestedproperty" not-null="true"/> <property name="nestedproperty" not-null="true"/>
</nested-composite-element> </nested-composite-element>

View File

@ -59,11 +59,11 @@
<many-to-one name="many" cascade="all" not-null="true"/> <many-to-one name="many" cascade="all" not-null="true"/>
</composite-element> </composite-element>
</bag> </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"/> <key column="container_id"/>
<many-to-many column="contained_id" class="org.hibernate.orm.test.legacy.Contained" outer-join="true"/> <many-to-many column="contained_id" class="org.hibernate.orm.test.legacy.Contained" outer-join="true"/>
</bag> </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"--> <!--cache usage="read-write"-->
<key column="container_id"/> <key column="container_id"/>
<many-to-many column="contained_id" class="org.hibernate.orm.test.legacy.Contained"/> <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" "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping default-lazy="false" <hibernate-mapping default-lazy="false"
default-cascade="save-update" default-cascade="merge,persist"
package="org.hibernate.orm.test.legacy"> package="org.hibernate.orm.test.legacy">
<class name="Eye" lazy="true"> <class name="Eye" lazy="true">

View File

@ -18,7 +18,7 @@
</id> </id>
<property name="name" unique="true" not-null="true"/> <property name="name" unique="true" not-null="true"/>
<property name="type" column="type_"/> <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"> <union-subclass name="J">
<property name="amount"/> <property name="amount"/>
</union-subclass> </union-subclass>

View File

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

View File

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

View File

@ -27,7 +27,7 @@
<class name="User" table="users"> <class name="User" table="users">
<id name="name"/> <id name="name"/>
<property name="password" column="pw"/> <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"/> <key column="userName" not-null="true"/>
<map-key formula="lower(name)" type="string"/> <map-key formula="lower(name)" type="string"/>
<one-to-many class="SessionAttribute"/> <one-to-many class="SessionAttribute"/>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -29,7 +29,7 @@
<property name="number" type="int" column="int" not-null="true" /> <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" /> <key column="ID_GARAGE" not-null="true" update="false" />
<one-to-many entity-name="Personaje"/> <one-to-many entity-name="Personaje"/>
</bag> </bag>

View File

@ -29,7 +29,7 @@
<property name="number" type="int" column="int" not-null="true" /> <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" /> <key column="ID_GARAGE" not-null="true" update="false" />
<one-to-many entity-name="Personaje"/> <one-to-many entity-name="Personaje"/>
</bag> </bag>