Skip to content
This repository was archived by the owner on Dec 8, 2023. It is now read-only.
This repository was archived by the owner on Dec 8, 2023. It is now read-only.

InsertBuilder auto set returning generated keys optional #3

@dneves

Description

@dneves
ps = connection.prepareStatement(query, Statement.RETURN_GENERATED_KEYS);

this code generates a 'RETURNING *' appended to the final query and this is not always the desired behavior.
for instance, i'd like to have a query like

insert into ... values ... returning id, column1, column2, ...

which can return not only the primary keys, but more columns.

Right now, i can 'force' this by setting 'returnGeneratedKeys' to false on BaseQuery, but need to cast the builder

InsertBuilder insertBuilder = InsertBuilder.into ...
Query query = insertBuilder.build();
( ( BaseQuery ) query ).setReturnGeneratedKeys( false );

Maybe it should be a setter on the InsertBuilder ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions