Skip to content

Join in DefaultSelectBuilder not working [DATAJDBC-475] #702

@spring-projects-issues

Description

@spring-projects-issues

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

Metadata

Metadata

Assignees

Labels

status: invalidAn issue that we don't feel is validtype: bugA general bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions