Project

General

Profile

« Previous | Next » 

Revision d29a0062

Added by Cherian Mathew over 8 years ago

Add merge method to return updated transient object for lists

View differences:

cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/IService.java
19 19

  
20 20
import org.hibernate.LockOptions;
21 21
import org.hibernate.Session;
22
import org.hibernate.event.spi.MergeEvent;
22 23

  
23 24
import eu.etaxonomy.cdm.api.service.pager.Pager;
24 25
import eu.etaxonomy.cdm.model.common.ICdmBase;
25 26
import eu.etaxonomy.cdm.persistence.dao.initializer.IBeanInitializer;
27
import eu.etaxonomy.cdm.persistence.hibernate.PostMergeEntityListener;
26 28
import eu.etaxonomy.cdm.persistence.query.Grouping;
27 29
import eu.etaxonomy.cdm.persistence.query.OrderHint;
28 30

  
......
350 352
    public List<T> merge(List<T> detachedObjects);
351 353

  
352 354
    /**
355
     * This method allows for the possibility of returning the input transient
356
     * entities instead of the merged persistent entity
357
     *
358
     * WARNING : This method should never be used when the objective of the merge
359
     * is to attach to an existing session which is the standard use case.
360
     * This method should only be used in the
361
     * case of an external call which does not use hibernate sessions and is
362
     * only interested in the entity as a POJO. Apart from the session information
363
     * the only other difference between the transient and persisted object is in the case
364
     * of new objects (id=0) where hibernate sets the id after commit. This id is copied
365
     * over to the transient entity in {@link PostMergeEntityListener#onMerge(MergeEvent,Map)}
366
     * making the two objects identical and allowing the transient object to be used further
367
     * as a POJO
368
     *
369
     * @param detachedObjects
370
     * @param returnTransientEntity
371
     * @return
372
     */
373
    public List<T> merge(List<T> detachedObjects, boolean returnTransientEntity);
374

  
375
    /**
376
     * This method allows for the possibility of returning the input transient
377
     * entity instead of the merged persistent entity
378
     *
379
     * WARNING : This method should never be used when the objective of the merge
380
     * is to attach to an existing session which is the standard use case.
381
     * This method should only be used in the
382
     * case of an external call which does not use hibernate sessions and is
383
     * only interested in the entity as a POJO. Apart from the session information
384
     * the only other difference between the transient and persisted object is in the case
385
     * of new objects (id=0) where hibernate sets the id after commit. This id is copied
386
     * over to the transient entity in {@link PostMergeEntityListener#onMerge(MergeEvent,Map)}
387
     * making the two objects identical and allowing the transient object to be used further
388
     * as a POJO
389
     *
353 390
     * @param newInstance
354 391
     * @param returnTransientEntity
355 392
     * @return
......
358 395

  
359 396

  
360 397

  
398

  
399

  
361 400
}

Also available in: Unified diff