August 2018
Intermediate to advanced
314 pages
8h 9m
English
We need to manage all processes of persistence and query data. For this, we need to create a class.
The PersistenceManager class is responsible for managing all persistence processes and query processes:
import javax.annotation.PostConstruct;import javax.inject.Inject;import java.util.LinkedHashSet;import java.util.Optional;import java.util.Set;import java.util.stream.Collectors;public class PersistenceManager { private Set<StageManager> stateManagers; @Inject @Transactional Transaction transaction; @PostConstruct public void init(){ stateManagers = new LinkedHashSet<StageManager>(); } public Optional<Entity> persist ( Entity entity ) { if ( entity instanceof Employee ){ stateManagers.add( new
Read now
Unlock full access