Reputation: 4615
What's the best approach in Ebean to execute a generalized (on a BaseEntity) bulk update query? I.e. something similar to the following Spring Data example:
update #{#entityName} e
set e.deletedDate = CURRENT_TIMESTAMP
where e in :entities
I understand Ebean has createUpdate method for bulk updates, but it requires writing the exact entity type in the query ("topic" in the below example):
DB.createUpdate(Topic.class, "update topic set ... where ...");
I can replace Topic.class with some clazz
variable, but I don't how to replace "topic" in the query string with something like BaseEntity.
P.S. No I don't want to use standard Ebean soft delete feature.
Upvotes: 0
Views: 12