Author: steve.ebersole(a)jboss.com
Date: 2007-08-13 18:15:53 -0400 (Mon, 13 Aug 2007)
New Revision: 12928
Modified:
core/trunk/testsuite/src/test/java/org/hibernate/test/readonly/ReadOnlyTest.java
Log:
added additional test
Modified:
core/trunk/testsuite/src/test/java/org/hibernate/test/readonly/ReadOnlyTest.java
===================================================================
---
core/trunk/testsuite/src/test/java/org/hibernate/test/readonly/ReadOnlyTest.java 2007-08-13
20:04:46 UTC (rev 12927)
+++
core/trunk/testsuite/src/test/java/org/hibernate/test/readonly/ReadOnlyTest.java 2007-08-13
22:15:53 UTC (rev 12928)
@@ -28,7 +28,7 @@
}
public String[] getMappings() {
- return new String[] { "readonly/DataPoint.hbm.xml" };
+ return new String[] { "readonly/DataPoint.hbm.xml",
"readonly/TextHolder.hbm.xml" };
}
public void configure(Configuration cfg) {
@@ -117,5 +117,36 @@
}
+ public void testReadOnlyOnTextType() {
+ final String origText = "some huge text string";
+ final String newText = "some even bigger text string";
+
+ Session s = openSession();
+ s.beginTransaction();
+ s.setCacheMode( CacheMode.IGNORE );
+ TextHolder holder = new TextHolder( origText );
+ s.save( holder );
+ Long id = holder.getId();
+ s.getTransaction().commit();
+ s.close();
+
+ s = openSession();
+ s.beginTransaction();
+ s.setCacheMode( CacheMode.IGNORE );
+ holder = ( TextHolder ) s.get( TextHolder.class, id );
+ s.setReadOnly( holder, true );
+ holder.setTheText( newText );
+ s.flush();
+ s.getTransaction().commit();
+ s.close();
+
+ s = openSession();
+ s.beginTransaction();
+ holder = ( TextHolder ) s.get( TextHolder.class, id );
+ assertEquals( "change written to database", origText, holder.getTheText() );
+ s.delete( holder );
+ s.getTransaction().commit();
+ s.close();
+ }
}
Show replies by date