File tree Expand file tree Collapse file tree 1 file changed +15
-10
lines changed
ebean-core/src/main/java/io/ebeaninternal/server/loadcontext Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -241,6 +241,20 @@ public void loadBean(EntityBeanIntercept ebi) {
241241 }
242242 // ensure, that every bean in the batch is in the persistence context.
243243 // this may happen, when bean was previously deleted, but the result is not yet committed.
244+ List <Object > reincarnatedIds = ensureBatchInContext (ebi );
245+ try {
246+ context .desc .ebeanServer ().loadBean (new LoadBeanRequest (this , ebi , context .hitCache ));
247+ batch .clear ();
248+ } finally {
249+ if (reincarnatedIds != null ) {
250+ for (Object id : reincarnatedIds ) {
251+ context .desc .contextClear (persistenceContext , id );
252+ }
253+ }
254+ }
255+ }
256+
257+ private List <Object > ensureBatchInContext (EntityBeanIntercept ebi ) {
244258 List <Object > reincarnatedIds = null ;
245259 for (EntityBeanIntercept batchEbi : batch ) {
246260 Object id = context .desc .getId (batchEbi .owner ());
@@ -254,16 +268,7 @@ public void loadBean(EntityBeanIntercept ebi) {
254268 }
255269 }
256270 }
257- try {
258- context .desc .ebeanServer ().loadBean (new LoadBeanRequest (this , ebi , context .hitCache ));
259- batch .clear ();
260- } finally {
261- if (reincarnatedIds != null ) {
262- for (Object id : reincarnatedIds ) {
263- context .desc .contextClear (persistenceContext , id );
264- }
265- }
266- }
271+ return reincarnatedIds ;
267272 }
268273 }
269274
You can’t perform that action at this time.
0 commit comments