ebean-orm / ebean-orm/ebean

support dynamic insert

Open
#3,602 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.5k
Forks
267
Avg merge
3d 20h
Merged PRs (30d)
5

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the db.save(obj) insert path and inspect how predefined insert statements are generated. Done means inserts can omit null properties so database defaults apply, with the preferred handling of omitted columns or the DEFAULT keyword decided.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, sql
Domain
backend, databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.