|
25 | 25 | import java.util.OptionalLong;
|
26 | 26 | import java.util.Set;
|
27 | 27 | import java.util.function.BiFunction;
|
| 28 | +import java.util.function.Function; |
28 | 29 |
|
29 | 30 | import org.springframework.dao.InvalidDataAccessResourceUsageException;
|
30 | 31 | import org.springframework.data.convert.CustomConversions.StoreConversions;
|
|
47 | 48 | import org.springframework.data.relational.core.mapping.RelationalPersistentProperty;
|
48 | 49 | import org.springframework.data.relational.core.sql.Expression;
|
49 | 50 | import org.springframework.data.relational.core.sql.OrderByField;
|
| 51 | +import org.springframework.data.relational.core.sql.Select; |
50 | 52 | import org.springframework.data.relational.core.sql.SelectBuilder.SelectFromAndOrderBy;
|
51 | 53 | import org.springframework.data.relational.core.sql.StatementBuilder;
|
52 | 54 | import org.springframework.data.relational.core.sql.Table;
|
53 | 55 | import org.springframework.data.relational.core.sql.render.NamingStrategies;
|
54 | 56 | import org.springframework.data.relational.core.sql.render.RenderContext;
|
55 | 57 | import org.springframework.data.relational.core.sql.render.RenderNamingStrategy;
|
| 58 | +import org.springframework.data.relational.core.sql.render.SelectRenderContext; |
56 | 59 | import org.springframework.lang.Nullable;
|
57 | 60 | import org.springframework.util.Assert;
|
58 | 61 | import org.springframework.util.ClassUtils;
|
@@ -121,6 +124,21 @@ public DefaultReactiveDataAccessStrategy(Dialect dialect, R2dbcConverter convert
|
121 | 124 | public RenderNamingStrategy getNamingStrategy() {
|
122 | 125 | return NamingStrategies.asIs();
|
123 | 126 | }
|
| 127 | + |
| 128 | + @Override |
| 129 | + public SelectRenderContext getSelect() { |
| 130 | + return new SelectRenderContext() { |
| 131 | + @Override |
| 132 | + public Function<Select, ? extends CharSequence> afterSelectList() { |
| 133 | + return it -> ""; |
| 134 | + } |
| 135 | + |
| 136 | + @Override |
| 137 | + public Function<Select, ? extends CharSequence> afterOrderBy(boolean hasOrderBy) { |
| 138 | + return it -> ""; |
| 139 | + } |
| 140 | + }; |
| 141 | + } |
124 | 142 | };
|
125 | 143 |
|
126 | 144 | this.statements = new DefaultStatementFactory(this.dialect, renderContext);
|
@@ -238,7 +256,7 @@ public String getTableName(Class<?> type) {
|
238 | 256 | return getRequiredPersistentEntity(type).getTableName();
|
239 | 257 | }
|
240 | 258 |
|
241 |
| - /* |
| 259 | + /* |
242 | 260 | * (non-Javadoc)
|
243 | 261 | * @see org.springframework.data.r2dbc.function.ReactiveDataAccessStrategy#getStatements()
|
244 | 262 | */
|
@@ -295,6 +313,7 @@ public String select(String tableName, Set<String> columns, Sort sort, Pageable
|
295 | 313 | offset = OptionalLong.of(page.getOffset());
|
296 | 314 | }
|
297 | 315 |
|
| 316 | + // See https://github.com/spring-projects/spring-data-r2dbc/issues/55 |
298 | 317 | return StatementRenderUtil.render(selectBuilder.build(), limit, offset, this.dialect);
|
299 | 318 | }
|
300 | 319 |
|
|
0 commit comments