@@ -35,35 +35,28 @@ protected Collection<Class<?>> annotatedEntities() {
3535 public void populateDb (VertxTestContext context ) {
3636 Seed seed1 = new Seed ( 1 );
3737 Flower rose = new Flower ( seed1 , "Rose" );
38+
3839 Fruit cherry = new Fruit ( seed1 , "Cherry" );
3940 cherry .addFriend ( rose );
4041
4142 Seed seed2 = new Seed ( 2 );
4243 Flower sunflower = new Flower ( seed2 , "Sunflower" );
44+
4345 Fruit apple = new Fruit ( seed2 , "Apple" );
4446 apple .addFriend ( sunflower );
4547
48+ Seed seed3 = new Seed ( 3 );
49+ Flower chrysanthemum = new Flower ( seed3 , "Chrysanthemum" );
50+
51+ Fruit banana = new Fruit ( seed3 , "Banana" );
52+ banana .addFriend ( chrysanthemum );
53+
4654 test (
4755 context ,
4856 getMutinySessionFactory ().withTransaction ( s -> s
49- .createNativeQuery ( "INSERT INTO known_fruits(id, name) VALUES (1, 'Cherry')" )
50- .executeUpdate ()
51- .call ( () -> s
52- .createNativeQuery ( "INSERT INTO known_fruits(id, name) VALUES (2, 'Apple');" )
53- .executeUpdate () )
54- .call ( () -> s
55- .createNativeQuery ( "INSERT INTO known_fruits(id, name) VALUES (3, 'Banana')" )
56- .executeUpdate () )
57- .call ( () -> s
58- .createNativeQuery ( "INSERT INTO known_flowers(id, name, friend) VALUES(1, 'Rose', 1)" )
59- .executeUpdate () )
60- .call ( () -> s
61- .createNativeQuery ( "INSERT INTO known_flowers(id, name, friend) VALUES(2, 'Sunflower', 2)" )
62- .executeUpdate () )
63- .call ( () -> s
64- .createNativeQuery ( "INSERT INTO known_flowers(id, name, friend) VALUES(3, 'Chrysanthemum', 2)" )
65- .executeUpdate () )
66- ) );
57+ .persistAll ( cherry , rose , sunflower , apple , chrysanthemum , banana )
58+ )
59+ );
6760 }
6861
6962 @ Test
@@ -167,7 +160,7 @@ public String toString() {
167160 public static class Flower extends Plant {
168161
169162 @ ManyToOne (fetch = FetchType .LAZY , optional = false )
170- @ JoinColumn (name = "friend" , referencedColumnName = "id" , insertable = false , updatable = false , nullable = false )
163+ @ JoinColumn (name = "friend" , referencedColumnName = "id" , nullable = false )
171164 private Fruit friend ;
172165
173166 public Flower () {
0 commit comments