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.
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 ofobj, 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
@DynamicInsertannotation. See: https://docs.jboss.org/hibernate/orm/6.5/javadocs/org/hibernate/annotations/DynamicInsert.htmlAlternatively, if complete SQL insert statements are preferred, the framework could explicitly include the
DEFAULTkeyword for such columns in the dynamically generated SQL statements.