Add capability to refresh multiple beans at once #3217
Replies: 2 comments 6 replies
-
As a workaround you could create a list of ids after I am not completely sure but if you do it in the same transaction chances are that your custom select would return the same instances Ebean has just saved but with updated fields because of the persistence context. |
Beta Was this translation helpful? Give feedback.
-
What is the database(s) being used and exactly what is this column, what is this use case? Generally this is going to be far from ideal (to do a lot of refresh calls). It might be worth looking at other options depending on the database but first we should understand exactly what the use case is. |
Beta Was this translation helpful? Give feedback.
-
Hi everyone,
Some of our entities have a column generated/populated by the database on INSERT.
Thus, after calling
save
we callrefresh
on the bean to get the value generated by database for this column.Now, we want to reproduce the same for batch
INSERT
. Inserstion is going well as there is asaveAll
method available.However the
refresh
method do not seems to allow passing multiple beans at once.Thus, we end up doing a
for loop
, calling refresh on each bean, resulting in a large amount of database query sent to the server.It could be interesting to have a
refreshAll
method that take a list of beans andSELECT
all of them in a unique server query.What do you think of this feature ?
Yours faithfully,
LCDP
Beta Was this translation helpful? Give feedback.
All reactions