Enhancement 314 : ENHANCEMENT - Add where() to Update and Delete
Priority 
High
Reported Version 
 
Logged By 
Rob
Status 
Fixed
Fixed Version 
github
Assigned To 
 
Product 
Ebean - core
Duplicate Of 
 
Created 
02/07/2010
Updated 
02/07/2010
Type 
Enhancement
 
Attachments 
No attachments

From Rien:

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:

Delete delete = Ebean.createDelete(Order.class); // can be
Update as well of course

delete.where().eq("myproperty", "somevalue");

int rows = delete.execute();

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:

Update update = Ebean.createUpdate(Order.class);

update.where().eq("myproperty", "somevalue");

update.setProperty("myproperty", "somenewvalue");

int rows = update.execute();

Let me know what you think.

 
Rob 02 Jul 22:48
I think this looks like a very good idea.

I think this looks like a very good idea.

woResponse

Upload a file