[hibernate-commits] Hibernate SVN: r14083 - in core/trunk: core/src/main/java/org/hibernate/tuple/entity and 2 other directories.
hibernate-commits at lists.jboss.org
hibernate-commits at lists.jboss.org
Tue Oct 16 17:04:10 EDT 2007
Author: steve.ebersole at jboss.com
Date: 2007-10-16 17:04:09 -0400 (Tue, 16 Oct 2007)
New Revision: 14083
Modified:
core/trunk/core/src/main/java/org/hibernate/loader/Loader.java
core/trunk/core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java
core/trunk/testsuite/src/test/java/org/hibernate/test/naturalid/immutable/ImmutableNaturalIdTest.java
core/trunk/testsuite/src/test/java/org/hibernate/test/naturalid/immutable/User.hbm.xml
core/trunk/testsuite/src/test/java/org/hibernate/test/naturalid/immutable/User.java
core/trunk/testsuite/src/test/java/org/hibernate/test/naturalid/mutable/MutableNaturalIdTest.java
core/trunk/testsuite/src/test/java/org/hibernate/test/naturalid/mutable/User.hbm.xml
Log:
HHH-2892 : natural id caching
Modified: core/trunk/core/src/main/java/org/hibernate/loader/Loader.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/loader/Loader.java 2007-10-16 11:15:21 UTC (rev 14082)
+++ core/trunk/core/src/main/java/org/hibernate/loader/Loader.java 2007-10-16 21:04:09 UTC (rev 14083)
@@ -2147,23 +2147,18 @@
}
private List getResultFromQueryCache(
- final SessionImplementor session,
- final QueryParameters queryParameters,
- final Set querySpaces,
+ final SessionImplementor session,
+ final QueryParameters queryParameters,
+ final Set querySpaces,
final Type[] resultTypes,
- final QueryCache queryCache,
+ final QueryCache queryCache,
final QueryKey key) {
List result = null;
-
- if ( session.getCacheMode().isGetEnabled() ) {
- result = queryCache.get(
- key,
- resultTypes,
- queryParameters.isNaturalKeyLookup(),
- querySpaces,
- session
- );
+ if ( session.getCacheMode().isGetEnabled() ) {
+ boolean isImmutableNaturalKeyLookup = queryParameters.isNaturalKeyLookup()
+ && getEntityPersisters()[0].getEntityMetamodel().hasImmutableNaturalId();
+ result = queryCache.get( key, resultTypes, isImmutableNaturalKeyLookup, querySpaces, session );
if ( factory.getStatistics().isStatisticsEnabled() ) {
if ( result == null ) {
factory.getStatisticsImplementor()
@@ -2174,28 +2169,20 @@
.queryCacheHit( getQueryIdentifier(), queryCache.getRegion().getName() );
}
}
-
}
-
+
return result;
}
private void putResultInQueryCache(
- final SessionImplementor session,
- final QueryParameters queryParameters,
+ final SessionImplementor session,
+ final QueryParameters queryParameters,
final Type[] resultTypes,
- final QueryCache queryCache,
- final QueryKey key,
+ final QueryCache queryCache,
+ final QueryKey key,
final List result) {
-
if ( session.getCacheMode().isPutEnabled() ) {
- boolean put = queryCache.put(
- key,
- resultTypes,
- result,
- queryParameters.isNaturalKeyLookup(),
- session
- );
+ boolean put = queryCache.put( key, resultTypes, result, queryParameters.isNaturalKeyLookup(), session );
if ( put && factory.getStatistics().isStatisticsEnabled() ) {
factory.getStatisticsImplementor()
.queryCachePut( getQueryIdentifier(), queryCache.getRegion().getName() );
Modified: core/trunk/core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java 2007-10-16 11:15:21 UTC (rev 14082)
+++ core/trunk/core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java 2007-10-16 21:04:09 UTC (rev 14083)
@@ -82,6 +82,7 @@
private final boolean hasNonIdentifierPropertyNamedId;
private final int[] naturalIdPropertyNumbers;
+ private final boolean hasImmutableNaturalId;
private boolean lazy; //not final because proxy factory creation can fail
private final boolean hasCascades;
@@ -159,6 +160,7 @@
boolean foundNonIdentifierPropertyNamedId = false;
boolean foundInsertGeneratedValue = false;
boolean foundUpdateGeneratedValue = false;
+ boolean foundUpdateableNaturalIdProperty = false;
while ( iter.hasNext() ) {
Property prop = ( Property ) iter.next();
@@ -173,6 +175,9 @@
if ( prop.isNaturalIdentifier() ) {
naturalIdNumbers.add( new Integer(i) );
+ if ( prop.isUpdateable() ) {
+ foundUpdateableNaturalIdProperty = true;
+ }
}
if ( "id".equals( prop.getName() ) ) {
@@ -229,9 +234,11 @@
if (naturalIdNumbers.size()==0) {
naturalIdPropertyNumbers = null;
+ hasImmutableNaturalId = false;
}
else {
naturalIdPropertyNumbers = ArrayHelper.toIntArray(naturalIdNumbers);
+ hasImmutableNaturalId = !foundUpdateableNaturalIdProperty;
}
hasInsertGeneratedValues = foundInsertGeneratedValue;
@@ -373,6 +380,10 @@
return naturalIdPropertyNumbers!=null;
}
+ public boolean hasImmutableNaturalId() {
+ return hasImmutableNaturalId;
+ }
+
public Set getSubclassEntityNames() {
return subclassEntityNames;
}
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/naturalid/immutable/ImmutableNaturalIdTest.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/naturalid/immutable/ImmutableNaturalIdTest.java 2007-10-16 11:15:21 UTC (rev 14082)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/naturalid/immutable/ImmutableNaturalIdTest.java 2007-10-16 21:04:09 UTC (rev 14083)
@@ -1,3 +1,18 @@
+/*
+ * Copyright (c) 2007, Red Hat Middleware, LLC. All rights reserved.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, v. 2.1. This program is distributed in the
+ * hope that it will be useful, but WITHOUT A WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details. You should have received a
+ * copy of the GNU Lesser General Public License, v.2.1 along with this
+ * distribution; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Red Hat Author(s): Steve Ebersole
+ */
package org.hibernate.test.naturalid.immutable;
import junit.framework.Test;
@@ -3,4 +18,9 @@
import org.hibernate.Session;
+import org.hibernate.Transaction;
+import org.hibernate.HibernateException;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Environment;
+import org.hibernate.criterion.Restrictions;
import org.hibernate.junit.functional.FunctionalTestCase;
import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
@@ -24,6 +44,12 @@
return new FunctionalTestClassTestSuite( ImmutableNaturalIdTest.class );
}
+ public void configure(Configuration cfg) {
+ cfg.setProperty( Environment.USE_SECOND_LEVEL_CACHE, "true" );
+ cfg.setProperty( Environment.USE_QUERY_CACHE, "true" );
+ cfg.setProperty( Environment.GENERATE_STATISTICS, "true" );
+ }
+
public void testUpdate() {
// prepare some test data...
Session session = openSession();
@@ -31,9 +57,6 @@
User user = new User();
user.setUserName( "steve" );
user.setEmail( "steve at hibernate.org" );
- user.setFirstName( "Steve" );
- user.setInitial( null);
- user.setLastName( "Ebersole" );
user.setPassword( "brewhaha" );
session.save( user );
session.getTransaction().commit();
@@ -54,4 +77,82 @@
session.getTransaction().commit();
session.close();
}
+
+ public void testNaturalIdCheck() throws Exception {
+ Session s = openSession();
+ Transaction t = s.beginTransaction();
+
+ User u = new User( "steve", "superSecret" );
+ s.persist( u );
+ u.setUserName( "Steve" );
+ try {
+ s.flush();
+ fail();
+ }
+ catch ( HibernateException he ) {
+ }
+ u.setUserName( "steve" );
+ s.delete( u );
+ t.commit();
+ s.close();
+ }
+
+ public void testNaturalIdCache() {
+ Session s = openSession();
+ s.beginTransaction();
+ User u = new User( "steve", "superSecret" );
+ s.persist( u );
+ s.getTransaction().commit();
+ s.close();
+
+ getSessions().getStatistics().clear();
+
+ s = openSession();
+ s.beginTransaction();
+ u = ( User ) s.createCriteria( User.class )
+ .add( Restrictions.naturalId().set( "userName", "steve" ) )
+ .setCacheable( true )
+ .uniqueResult();
+ assertNotNull( u );
+ s.getTransaction().commit();
+ s.close();
+
+ assertEquals( getSessions().getStatistics().getQueryExecutionCount(), 1 );
+ assertEquals( getSessions().getStatistics().getQueryCacheHitCount(), 0 );
+ assertEquals( getSessions().getStatistics().getQueryCachePutCount(), 1 );
+
+ s = openSession();
+ s.beginTransaction();
+ User v = new User( "gavin", "supsup" );
+ s.persist( v );
+ s.getTransaction().commit();
+ s.close();
+
+ getSessions().getStatistics().clear();
+
+ s = openSession();
+ s.beginTransaction();
+ u = ( User ) s.createCriteria( User.class )
+ .add( Restrictions.naturalId().set( "userName", "steve" ) )
+ .setCacheable( true )
+ .uniqueResult();
+ assertNotNull( u );
+ assertEquals( getSessions().getStatistics().getQueryExecutionCount(), 0 );
+ assertEquals( getSessions().getStatistics().getQueryCacheHitCount(), 1 );
+ u = ( User ) s.createCriteria( User.class )
+ .add( Restrictions.naturalId().set( "userName", "steve" ) )
+ .setCacheable( true )
+ .uniqueResult();
+ assertNotNull( u );
+ assertEquals( getSessions().getStatistics().getQueryExecutionCount(), 0 );
+ assertEquals( getSessions().getStatistics().getQueryCacheHitCount(), 2 );
+ s.getTransaction().commit();
+ s.close();
+
+ s = openSession();
+ s.beginTransaction();
+ s.createQuery( "delete User" ).executeUpdate();
+ s.getTransaction().commit();
+ s.close();
+ }
}
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/naturalid/immutable/User.hbm.xml
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/naturalid/immutable/User.hbm.xml 2007-10-16 11:15:21 UTC (rev 14082)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/naturalid/immutable/User.hbm.xml 2007-10-16 21:04:09 UTC (rev 14083)
@@ -1,11 +1,32 @@
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+<!--
+ ~ Copyright (c) 2007, Red Hat Middleware, LLC. All rights reserved.
+ ~
+ ~ This copyrighted material is made available to anyone wishing to use, modify,
+ ~ copy, or redistribute it subject to the terms and conditions of the GNU
+ ~ Lesser General Public License, v. 2.1. This program is distributed in the
+ ~ hope that it will be useful, but WITHOUT A WARRANTY; without even the implied
+ ~ warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details. You should have received a
+ ~ copy of the GNU Lesser General Public License, v.2.1 along with this
+ ~ distribution; if not, write to the Free Software Foundation, Inc.,
+ ~ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ ~
+ ~ Red Hat Author(s): Steve Ebersole
+ -->
+
+<!--
+
+ This mapping illustrates use of <natural-id mutable="false"/>
+
+-->
<hibernate-mapping package="org.hibernate.test.naturalid.immutable">
- <class name="User" table="IMM_NAT_ID_USER" lazy="true">
+ <class name="User" table="IMM_NAT_ID_USER" lazy="true">
<comment>Users may bid for or sell auction items.</comment>
<id name="myUserId" type="java.lang.Integer">
<generator class="increment"/>
@@ -16,9 +37,6 @@
<version name="version"/>
<property name="password" not-null="true" length="15" column="`password`"/>
<property name="email"/>
- <property name="firstName" length="50" not-null="true"/>
- <property name="initial" column="`initial`"/>
- <property name="lastName" length="50" not-null="true"/>
</class>
</hibernate-mapping>
\ No newline at end of file
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/naturalid/immutable/User.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/naturalid/immutable/User.java 2007-10-16 11:15:21 UTC (rev 14082)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/naturalid/immutable/User.java 2007-10-16 21:04:09 UTC (rev 14083)
@@ -1,3 +1,18 @@
+/*
+ * Copyright (c) 2007, Red Hat Middleware, LLC. All rights reserved.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, v. 2.1. This program is distributed in the
+ * hope that it will be useful, but WITHOUT A WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details. You should have received a
+ * copy of the GNU Lesser General Public License, v.2.1 along with this
+ * distribution; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Red Hat Author(s): Steve Ebersole
+ */
package org.hibernate.test.naturalid.immutable;
/**
@@ -12,13 +27,15 @@
private String userName;
private String password;
private String email;
- private String firstName;
- private Character initial;
- private String lastName;
public User() {
}
+ public User(String userName, String password) {
+ this.userName = userName;
+ this.password = password;
+ }
+
public Integer getMyUserId() {
return this.myUserId;
}
@@ -51,30 +68,6 @@
this.email = email;
}
- public String getFirstName() {
- return this.firstName;
- }
-
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
-
- public Character getInitial() {
- return this.initial;
- }
-
- public void setInitial(Character initial) {
- this.initial = initial;
- }
-
- public String getLastName() {
- return this.lastName;
- }
-
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
-
public Integer getVersion() {
return this.version;
}
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/naturalid/mutable/MutableNaturalIdTest.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/naturalid/mutable/MutableNaturalIdTest.java 2007-10-16 11:15:21 UTC (rev 14082)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/naturalid/mutable/MutableNaturalIdTest.java 2007-10-16 21:04:09 UTC (rev 14083)
@@ -1,4 +1,4 @@
-//$Id: MutableNaturalIdTest.java 10977 2006-12-12 23:28:04Z steve.ebersole at jboss.com $
+//$Id: MutableNaturalIdTest.java 11645 2007-06-06 21:33:31Z steve.ebersole at jboss.com $
package org.hibernate.test.naturalid.mutable;
import java.lang.reflect.Field;
@@ -8,7 +8,6 @@
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.Transaction;
-import org.hibernate.test.naturalid.mutable.User;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
import org.hibernate.criterion.Restrictions;
@@ -19,7 +18,7 @@
* @author Gavin King
*/
public class MutableNaturalIdTest extends FunctionalTestCase {
-
+
public MutableNaturalIdTest(String str) {
super(str);
}
@@ -37,98 +36,117 @@
public static Test suite() {
return new FunctionalTestClassTestSuite( MutableNaturalIdTest.class );
}
-
- public void testNaturalIdCheck() throws Exception {
+
+ public void testReattachmentNaturalIdCheck() throws Throwable {
Session s = openSession();
- Transaction t = s.beginTransaction();
-
- User u = new User("gavin", "hb", "secret");
- s.persist(u);
+ s.beginTransaction();
+ User u = new User( "gavin", "hb", "secret" );
+ s.persist( u );
+ s.getTransaction().commit();
+ s.close();
+
Field name = u.getClass().getDeclaredField("name");
name.setAccessible(true);
name.set(u, "Gavin");
+ s = openSession();
+ s.beginTransaction();
try {
- s.flush();
- fail();
+ s.update( u );
+ s.getTransaction().commit();
}
- catch (HibernateException he) {}
- name.set(u, "gavin");
- s.delete(u);
- t.commit();
+ catch( HibernateException expected ) {
+ s.getTransaction().rollback();
+ }
+ catch( Throwable t ) {
+ try {
+ s.getTransaction().rollback();
+ }
+ catch ( Throwable ignore ) {
+ }
+ throw t;
+ }
+ finally {
+ s.close();
+ }
+
+ s = openSession();
+ s.beginTransaction();
+ s.delete( u );
+ s.getTransaction().commit();
s.close();
}
-
+
public void testNonexistentNaturalIdCache() {
getSessions().getStatistics().clear();
Session s = openSession();
Transaction t = s.beginTransaction();
-
+
Object nullUser = s.createCriteria(User.class)
.add( Restrictions.naturalId()
.set("name", "gavin")
- .set("org", "hb")
+ .set("org", "hb")
)
.setCacheable(true)
.uniqueResult();
-
+
assertNull(nullUser);
-
+
t.commit();
s.close();
-
+
assertEquals( getSessions().getStatistics().getQueryExecutionCount(), 1 );
assertEquals( getSessions().getStatistics().getQueryCacheHitCount(), 0 );
assertEquals( getSessions().getStatistics().getQueryCachePutCount(), 0 );
-
+
s = openSession();
t = s.beginTransaction();
-
+
User u = new User("gavin", "hb", "secret");
s.persist(u);
-
+
t.commit();
s.close();
-
+
getSessions().getStatistics().clear();
s = openSession();
t = s.beginTransaction();
-
+
u = (User) s.createCriteria(User.class)
.add( Restrictions.naturalId()
.set("name", "gavin")
- .set("org", "hb")
+ .set("org", "hb")
)
.setCacheable(true)
.uniqueResult();
-
+
assertNotNull(u);
-
+
t.commit();
s.close();
assertEquals( getSessions().getStatistics().getQueryExecutionCount(), 1 );
assertEquals( getSessions().getStatistics().getQueryCacheHitCount(), 0 );
assertEquals( getSessions().getStatistics().getQueryCachePutCount(), 1 );
-
+
getSessions().getStatistics().clear();
s = openSession();
t = s.beginTransaction();
-
+
u = (User) s.createCriteria(User.class)
.add( Restrictions.naturalId()
.set("name", "gavin")
- .set("org", "hb")
+ .set("org", "hb")
).setCacheable(true)
.uniqueResult();
-
+
s.delete(u);
-
+
t.commit();
s.close();
-
+
assertEquals( getSessions().getStatistics().getQueryExecutionCount(), 0 );
assertEquals( getSessions().getStatistics().getQueryCacheHitCount(), 1 );
@@ -136,86 +154,96 @@
s = openSession();
t = s.beginTransaction();
-
+
nullUser = s.createCriteria(User.class)
.add( Restrictions.naturalId()
.set("name", "gavin")
- .set("org", "hb")
+ .set("org", "hb")
)
.setCacheable(true)
.uniqueResult();
-
+
assertNull(nullUser);
-
+
t.commit();
s.close();
-
+
assertEquals( getSessions().getStatistics().getQueryExecutionCount(), 1 );
assertEquals( getSessions().getStatistics().getQueryCacheHitCount(), 0 );
assertEquals( getSessions().getStatistics().getQueryCachePutCount(), 0 );
-
+
}
public void testNaturalIdCache() {
Session s = openSession();
Transaction t = s.beginTransaction();
-
+
User u = new User("gavin", "hb", "secret");
s.persist(u);
-
+
t.commit();
s.close();
-
+
getSessions().getStatistics().clear();
s = openSession();
t = s.beginTransaction();
-
+
u = (User) s.createCriteria(User.class)
.add( Restrictions.naturalId()
.set("name", "gavin")
- .set("org", "hb")
+ .set("org", "hb")
)
.setCacheable(true)
.uniqueResult();
-
+
assertNotNull(u);
-
+
t.commit();
s.close();
assertEquals( getSessions().getStatistics().getQueryExecutionCount(), 1 );
assertEquals( getSessions().getStatistics().getQueryCacheHitCount(), 0 );
assertEquals( getSessions().getStatistics().getQueryCachePutCount(), 1 );
-
+
s = openSession();
t = s.beginTransaction();
-
+
User v = new User("xam", "hb", "foobar");
s.persist(v);
-
+
t.commit();
s.close();
-
+
getSessions().getStatistics().clear();
s = openSession();
t = s.beginTransaction();
-
- u = (User) s.createCriteria(User.class)
+
+ u = (User) s.createCriteria( User.class)
.add( Restrictions.naturalId()
.set("name", "gavin")
- .set("org", "hb")
+ .set("org", "hb")
).setCacheable(true)
.uniqueResult();
-
+
assertNotNull(u);
-
+ assertEquals( getSessions().getStatistics().getQueryExecutionCount(), 1 );
+ assertEquals( getSessions().getStatistics().getQueryCacheHitCount(), 0 );
+
+ u = (User) s.createCriteria( User.class)
+ .add( Restrictions.naturalId()
+ .set("name", "gavin")
+ .set("org", "hb")
+ ).setCacheable(true)
+ .uniqueResult();
+
+ assertNotNull(u);
+ assertEquals( getSessions().getStatistics().getQueryExecutionCount(), 1 );
+ assertEquals( getSessions().getStatistics().getQueryCacheHitCount(), 1 );
+
t.commit();
s.close();
-
- assertEquals( getSessions().getStatistics().getQueryExecutionCount(), 0 );
- assertEquals( getSessions().getStatistics().getQueryCacheHitCount(), 1 );
s = openSession();
t = s.beginTransaction();
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/naturalid/mutable/User.hbm.xml
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/naturalid/mutable/User.hbm.xml 2007-10-16 11:15:21 UTC (rev 14082)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/naturalid/mutable/User.hbm.xml 2007-10-16 21:04:09 UTC (rev 14083)
@@ -1,27 +1,27 @@
<?xml version="1.0"?>
-<!DOCTYPE hibernate-mapping PUBLIC
+<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
- This mapping illustrates use of <natural-id>.
-
+ This mapping illustrates use of <natural-id mutable="true"/>
+
-->
-<hibernate-mapping
+<hibernate-mapping
package="org.hibernate.test.naturalid"
default-access="field">
-
+
<class name="org.hibernate.test.naturalid.mutable.User" table="SystemUserInfo">
<id name="id">
<generator class="increment"/>
</id>
- <natural-id>
+ <natural-id mutable="true">
<property name="name"/>
<property name="org"/>
</natural-id>
<property name="password"/>
</class>
-
+
</hibernate-mapping>
\ No newline at end of file
More information about the hibernate-commits
mailing list