-
Notifications
You must be signed in to change notification settings - Fork 373
Description
Mark Paluch opened DATAJDBC-475 and commented
val selectBuilder = StatementBuilder .select(columns).from(doc) .join(folder).on(Column.create("folder_id", doc)).equals(Column.create("id", folder))
After execute return next error:
{code:}
bad SQL grammar [SELECT doc.id, doc.date, doc.header, doc.parent_id, doc.status FROM doc JOIN folder ON doc.folder_id = folder.id JOIN folder ON doc.folder_id = folder.id AND doc.folder_id = folder.id JOIN folder ON doc.folder_id = folder.id AND doc.folder_id = folder.id AND doc.folder_id = folder.id JOIN folder ON doc.folder_id = folder.id AND doc.folder_id = folder.id AND doc.folder_id = folder.id AND doc.folder_id = folder.id WHERE doc.id = $1 ORDER BY date ASC, id ASC LIMIT 2 OFFSET 0]; nested exception is io.r2dbc.postgresql.ExceptionFactory$PostgresqlBadGrammarException: [42712] table name "folder" specified more than once
In org.springframework.data.relational.core.sql.DefaultSelectBuilder
each method where, orderBy, limit, offset in class DefaultSelectBuilder has row selectBuilder.join(finishJoin()) with next body this.joins.add(join)
I try to remove row selectBuilder.join(finishJoin()) in all methods just left in DefaultSelectBuilder.JoinBuilder.build() and criteria query success executed
Reference URL: spring-projects/spring-data-r2dbc#266