Skip to content

Commit f503dc7

Browse files
committed
Formatting
1 parent 4391bde commit f503dc7

File tree

3 files changed

+28
-27
lines changed

3 files changed

+28
-27
lines changed

jpa/aggregate-function-in-select/src/main/java/org/javaee7/jpa/aggregate_function_in_select/entity/AggregatedTestEntity.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@
77
*
88
*/
99
public class AggregatedTestEntity {
10-
11-
private String values;
1210

13-
public AggregatedTestEntity(String values) {
14-
this.values = values;
15-
}
16-
17-
public String getValues() {
18-
return values;
19-
}
11+
private String values;
2012

21-
public void setValues(String values) {
22-
this.values = values;
23-
}
13+
public AggregatedTestEntity(String values) {
14+
this.values = values;
15+
}
16+
17+
public String getValues() {
18+
return values;
19+
}
20+
21+
public void setValues(String values) {
22+
this.values = values;
23+
}
2424

2525
}

jpa/aggregate-function-in-select/src/main/java/org/javaee7/jpa/aggregate_function_in_select/service/TestService.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,16 @@ public void saveEntities() {
3535

3636
public List<AggregatedTestEntity> getAggregation() {
3737
return entityManager
38-
.createQuery(
39-
// Note that GROUP_CONCAT is a DB specific function, in this case for HSQLDB.
40-
"SELECT new org.javaee7.jpa.aggregate_function_in_select.entity.AggregatedTestEntity("
41-
+ "FUNCTION('GROUP_CONCAT', _testEntity.value)"
42-
+ ") "
43-
+ "FROM "
44-
+ " TestEntity _testEntity ",
45-
AggregatedTestEntity.class)
46-
.getResultList();
38+
.createQuery(
39+
// Note that GROUP_CONCAT is a DB specific function, in this
40+
// case for HSQLDB.
41+
"SELECT new org.javaee7.jpa.aggregate_function_in_select.entity.AggregatedTestEntity("
42+
+ "FUNCTION('GROUP_CONCAT', _testEntity.value)"
43+
+") "
44+
+"FROM "
45+
+ "TestEntity _testEntity ",
46+
AggregatedTestEntity.class
47+
).getResultList();
4748
}
4849

4950
}

jpa/aggregate-function-in-select/src/test/java/org/javaee7/jpa/aggregate_function_in_select/AggregateFunctionInSelectTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,16 @@ public void aggregateFunctionInCtorSelectJPQL() throws Exception {
5454
List<AggregatedTestEntity> testEntities = testService.getAggregation();
5555

5656
assertTrue(
57-
"All entities should have been aggregated into 1 result row",
58-
testEntities.size() == 1
59-
);
57+
"All entities should have been aggregated into 1 result row",
58+
testEntities.size() == 1
59+
);
6060

6161
String values = testEntities.get(0).getValues();
6262

6363
assertTrue(
64-
"Aggregation should be 1,2 or 2,1, but was: " + values,
65-
values.equals("1,2") || values.equals("2,1") // order doesn't matter here
66-
);
64+
"Aggregation should be 1,2 or 2,1, but was: " + values,
65+
values.equals("1,2") || values.equals("2,1") // order doesn't matter here
66+
);
6767
}
6868

6969
private static File resource(String name) {

0 commit comments

Comments
 (0)