~raginggoblin/infolog/infolog

« back to all changes in this revision

Viewing changes to InfologServer/lib/hibernate-annotations-3.4.0.GA/test/org/hibernate/test/annotations/various/VersionTest.java

  • Committer: Raging Goblin
  • Date: 2013-11-16 16:51:32 UTC
  • Revision ID: raging_goblin-20131116165132-weujnptzc88uy4ah
Mavenized the project, now using shared project InfologSync

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
//$Id: VersionTest.java 14736 2008-06-04 14:23:42Z hardy.ferentschik $
2
 
package org.hibernate.test.annotations.various;
3
 
 
4
 
import org.hibernate.Session;
5
 
import org.hibernate.test.annotations.TestCase;
6
 
 
7
 
/**
8
 
 * @author Emmanuel Bernard
9
 
 */
10
 
public class VersionTest extends TestCase {
11
 
 
12
 
        public void testOptimisticLockDisabled() throws Exception {
13
 
                Conductor c = new Conductor();
14
 
                c.setName( "Bob" );
15
 
                Session s = openSession( );
16
 
                s.getTransaction().begin();
17
 
                s.persist( c );
18
 
                s.flush();
19
 
 
20
 
                s.clear();
21
 
 
22
 
                c = (Conductor) s.get( Conductor.class, c.getId() );
23
 
                Long version = c.getVersion();
24
 
                c.setName( "Don" );
25
 
                s.flush();
26
 
 
27
 
                s.clear();
28
 
 
29
 
                c = (Conductor) s.get( Conductor.class, c.getId() );
30
 
                assertEquals( version, c.getVersion() );
31
 
 
32
 
                s.getTransaction().rollback();
33
 
                s.close();
34
 
        }
35
 
 
36
 
        protected Class[] getMappings() {
37
 
                return new Class[] {
38
 
                                Conductor.class
39
 
                };
40
 
        }
41
 
}