15
15
*/
16
16
package org .springframework .data .jdbc .core ;
17
17
18
- import static org .assertj .core .api .Assertions .*;
19
-
20
18
import java .util .Map ;
21
19
import java .util .Set ;
22
20
23
21
import org .assertj .core .api .SoftAssertions ;
24
22
import org .junit .Before ;
25
23
import org .junit .Test ;
24
+
26
25
import org .springframework .data .annotation .Id ;
27
26
import org .springframework .data .jdbc .mapping .model .DefaultNamingStrategy ;
28
27
import org .springframework .data .jdbc .mapping .model .JdbcMappingContext ;
31
30
import org .springframework .data .jdbc .mapping .model .NamingStrategy ;
32
31
import org .springframework .data .mapping .PropertyPath ;
33
32
33
+ import static org .assertj .core .api .Assertions .*;
34
+
34
35
/**
35
36
* Unit tests for the {@link SqlGenerator}.
36
37
*
@@ -115,9 +116,9 @@ public void findAllByProperty() {
115
116
// this would get called when DummyEntity is the element type of a Set
116
117
String sql = sqlGenerator .getFindAllByProperty ("back-ref" , null );
117
118
118
- assertThat (sql ).isEqualTo ("SELECT DummyEntity.id AS id , DummyEntity.name AS name , "
119
- + "ref.l1id AS ref_l1id , ref.content AS ref_content , ref.further AS ref_further "
120
- + "FROM DummyEntity LEFT OUTER JOIN ReferencedEntity AS ref ON ref.DummyEntity = DummyEntity.id "
119
+ assertThat (sql ).isEqualTo ("SELECT DummyEntity.x_id AS x_id , DummyEntity.x_name AS x_name , "
120
+ + "ref.x_l1id AS ref_x_l1id , ref.x_content AS ref_x_content , ref.x_further AS ref_x_further "
121
+ + "FROM DummyEntity LEFT OUTER JOIN ReferencedEntity AS ref ON ref.DummyEntity = DummyEntity.x_id "
121
122
+ "WHERE back-ref = :back-ref" );
122
123
}
123
124
@@ -127,10 +128,10 @@ public void findAllByPropertyWithKey() {
127
128
// this would get called when DummyEntity is th element type of a Map
128
129
String sql = sqlGenerator .getFindAllByProperty ("back-ref" , "key-column" );
129
130
130
- assertThat (sql ).isEqualTo ("SELECT DummyEntity.id AS id , DummyEntity.name AS name , "
131
- + "ref.l1id AS ref_l1id , ref.content AS ref_content , ref.further AS ref_further , "
131
+ assertThat (sql ).isEqualTo ("SELECT DummyEntity.x_id AS x_id , DummyEntity.x_name AS x_name , "
132
+ + "ref.x_l1id AS ref_x_l1id , ref.x_content AS ref_x_content , ref.x_further AS ref_x_further , "
132
133
+ "DummyEntity.key-column AS key-column "
133
- + "FROM DummyEntity LEFT OUTER JOIN ReferencedEntity AS ref ON ref.DummyEntity = DummyEntity.id "
134
+ + "FROM DummyEntity LEFT OUTER JOIN ReferencedEntity AS ref ON ref.DummyEntity = DummyEntity.x_id "
134
135
+ "WHERE back-ref = :back-ref" );
135
136
}
136
137
0 commit comments