File tree Expand file tree Collapse file tree 1 file changed +26
-2
lines changed
hibernate-core/src/test/java/org/hibernate/orm/test/stateless Expand file tree Collapse file tree 1 file changed +26
-2
lines changed Original file line number Diff line number Diff line change 88import org .junit .jupiter .api .Test ;
99
1010import static org .junit .Assert .assertEquals ;
11+ import static org .junit .jupiter .api .Assertions .assertNotNull ;
1112
1213@ SessionFactory
13- @ DomainModel (annotatedClasses = UpsertTest .Record .class )
14+ @ DomainModel (annotatedClasses = { UpsertTest .Record .class , UpsertTest . IdOnly . class } )
1415public class UpsertTest {
1516 @ Test void test (SessionFactoryScope scope ) {
1617 scope .inStatelessTransaction (s -> {
@@ -29,7 +30,18 @@ public class UpsertTest {
2930 assertEquals ("hello mars" ,s .get (Record .class ,456L ).message );
3031 });
3132 }
32- @ Entity
33+ @ Test void testIdOnly (SessionFactoryScope scope ) {
34+ scope .inStatelessTransaction (s -> {
35+ s .upsert (new IdOnly (123L ));
36+ s .upsert (new IdOnly (456L ));
37+ });
38+ scope .inStatelessTransaction (s -> {
39+ assertNotNull (s .get ( IdOnly .class ,123L ));
40+ assertNotNull (s .get ( IdOnly .class ,456L ));
41+ });
42+ }
43+
44+ @ Entity
3345 static class Record {
3446 @ Id Long id ;
3547 String message ;
@@ -42,4 +54,16 @@ static class Record {
4254 Record () {
4355 }
4456 }
57+
58+ @ Entity (name = "IdOnly" )
59+ static class IdOnly {
60+ @ Id Long id ;
61+
62+ IdOnly (Long id ) {
63+ this .id = id ;
64+ }
65+
66+ IdOnly () {
67+ }
68+ }
4569}
You can’t perform that action at this time.
0 commit comments