@@ -35,35 +35,28 @@ protected Collection<Class<?>> annotatedEntities() {
35
35
public void populateDb (VertxTestContext context ) {
36
36
Seed seed1 = new Seed ( 1 );
37
37
Flower rose = new Flower ( seed1 , "Rose" );
38
+
38
39
Fruit cherry = new Fruit ( seed1 , "Cherry" );
39
40
cherry .addFriend ( rose );
40
41
41
42
Seed seed2 = new Seed ( 2 );
42
43
Flower sunflower = new Flower ( seed2 , "Sunflower" );
44
+
43
45
Fruit apple = new Fruit ( seed2 , "Apple" );
44
46
apple .addFriend ( sunflower );
45
47
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
+
46
54
test (
47
55
context ,
48
56
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
+ );
67
60
}
68
61
69
62
@ Test
@@ -167,7 +160,7 @@ public String toString() {
167
160
public static class Flower extends Plant {
168
161
169
162
@ 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 )
171
164
private Fruit friend ;
172
165
173
166
public Flower () {
0 commit comments