-
-
Notifications
You must be signed in to change notification settings - Fork 259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENH: Add support for using where() on bulk Update statements #120
Comments
+1 |
Note that for Delete you can now do this via: #398 |
+1, this is discuss in #459 |
👍 |
This only relates to updates now so changing title. |
@rbygrave , has plan to support this future? |
Q: Would I like to support this feature? Q: When might I get to look at implementing it? |
So this has been supported by the addition of UpdateQuery which has some set() methods and uses an underlying Query. Example 1: int rows = server.update(Customer.class);
.set("status", Customer.Status.ACTIVE)
.set("updtime", new Timestamp(System.currentTimeMillis()))
.where()
.eq("status", Customer.Status.NEW)
.eq("billingAddress.country", nz)
.gt("id", 1000)
.update(); Example 2: int rows = server
.update(Customer.class)
.set("status", Customer.Status.ACTIVE)
.set("updtime", new Timestamp(System.currentTimeMillis()))
.where()
.eq("status", Customer.Status.NEW)
.gt("id", 1000)
.update(); Note that there is a .setRaw("status = coalesce(status, ?)", Customer.Status.ACTIVE) .setRaw("status = coalesce(status, 'A')") .setNull("notes") |
Hi,
I was looking at the option to do createUpdate() on Ebean and noticed
that you have to write the where clause yourself. Is it an option to
use the expression lists from queries for this as well.
So we would get something like:
etc.
This way we can use the same code for select queries and delete
queries.
Would be nice if this would include some option to update as well, but
maybe that's to much to ask for:
Let me know what you think.
The text was updated successfully, but these errors were encountered: