File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
hibernate-core/src/test/java/org/hibernate/orm/test/cache Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 1313import org .hibernate .annotations .CacheConcurrencyStrategy ;
1414
1515import org .hibernate .testing .orm .junit .DomainModel ;
16+ import org .hibernate .testing .orm .junit .Jira ;
1617import org .hibernate .testing .orm .junit .SessionFactory ;
1718import org .hibernate .testing .orm .junit .SessionFactoryScope ;
1819import org .junit .jupiter .api .AfterAll ;
@@ -75,6 +76,22 @@ public void test(SessionFactoryScope scope) {
7576 } );
7677 }
7778
79+ @ Test
80+ @ Jira ("https://hibernate.atlassian.net/browse/HHH-5689" )
81+ public void testRollback (SessionFactoryScope scope ) {
82+ scope .inTransaction ( session -> {
83+ final Phone phone = session .find ( Phone .class , PHONE_ID );
84+ phone .setNumber ( "456" );
85+ session .flush ();
86+ session .markForRollbackOnly ();
87+ } );
88+ // in a different transaction
89+ scope .inTransaction ( session -> {
90+ final Phone phone = session .find ( Phone .class , PHONE_ID );
91+ assertThat ( phone .getNumber () ).isEqualTo ( "123" );
92+ } );
93+ }
94+
7895 @ Entity ( name = "Phone" )
7996 @ Cacheable
8097 @ Cache ( usage = CacheConcurrencyStrategy .TRANSACTIONAL )
You can’t perform that action at this time.
0 commit comments