Skip to content

support dynamic insert #3602

Description

@wenzhihong2003

hi, bob:

When calling db.save(obj) for insert operations, it would be helpful if the insert statement were dynamically generated based on the non-null properties of obj, rather than using a predefined insert statement with all the fields included.
I understand this might impact performance slightly; however, this approach would leverage database-default-column-values effectively. If some columns are omitted from the insert statement, the database could automatically assign default values defined for those columns.
For reference, Hibernate provides a similar feature through the @DynamicInsert annotation. See: https://docs.jboss.org/hibernate/orm/6.5/javadocs/org/hibernate/annotations/DynamicInsert.html
Alternatively, if complete SQL insert statements are preferred, the framework could explicitly include the DEFAULT keyword for such columns in the dynamically generated SQL statements.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions