List of usage examples for org.hibernate FlushMode AUTO
FlushMode AUTO
To view the source code for org.hibernate FlushMode AUTO.
Click Source Link
From source file:sql.support.ExecutionContextConversionTestImpl.java
License:LGPL
@Override public FlushMode getHibernateFlushMode() { return FlushMode.AUTO; }
From source file:systemrecrutement.JavaLibrary3PersistentManager.java
private JavaLibrary3PersistentManager() throws PersistentException { super(_connectionSetting, _sessionType, _timeToAlive, new String[] {}, _extraProperties, _configurationFile);/* w w w. j a v a2 s. com*/ setFlushMode(FlushMode.AUTO); }
From source file:timelogger.domain.TimeloggerPersistentManager.java
private TimeloggerPersistentManager() throws PersistentException { super(_connectionSetting, _sessionType, _timeToAlive, new String[] {}, _extraProperties); setFlushMode(FlushMode.AUTO); }
From source file:tp_aa.TPAAPersistentManager.java
private TPAAPersistentManager() throws PersistentException { super(_connectionSetting, _sessionType, _timeToAlive, new String[] {}, _extraProperties, _configurationFile);// w ww . jav a 2s . com setFlushMode(FlushMode.AUTO); }
From source file:tr.com.srdc.icardea.hibernate.ICardeaPersistentManager.java
private ICardeaPersistentManager() throws PersistentException { super(_connectionSetting, _sessionType, _timeToAlive, new String[] {}, _extraProperties); setFlushMode(FlushMode.AUTO); }
From source file:ubic.gemma.persistence.persister.ArrayDesignPersister.java
License:Apache License
/** * Persist an entirely new array design, including composite sequences and any associated new sequences. *///from www. ja v a 2 s. c om private ArrayDesign persistNewArrayDesign(ArrayDesign arrayDesign) { if (arrayDesign == null) return null; AbstractPersister.log.info("Persisting new platform " + arrayDesign.getName()); try { this.getSessionFactory().getCurrentSession().setFlushMode(FlushMode.COMMIT); if (arrayDesign.getDesignProvider() != null) arrayDesign.setDesignProvider(this.persistContact(arrayDesign.getDesignProvider())); if (arrayDesign.getPrimaryTaxon() == null) { throw new IllegalArgumentException("Primary taxon cannot be null"); } arrayDesign.setPrimaryTaxon((Taxon) this.persist(arrayDesign.getPrimaryTaxon())); for (DatabaseEntry externalRef : arrayDesign.getExternalReferences()) { externalRef.setExternalDatabase(this.persistExternalDatabase(externalRef.getExternalDatabase())); } AbstractPersister.log.info("Persisting " + arrayDesign); if (arrayDesign.getAuditTrail() != null && this.isTransient(arrayDesign.getAuditTrail())) arrayDesign.getAuditTrail().setId(null); Collection<CompositeSequence> scs = new ArrayList<>(arrayDesign.getCompositeSequences()); arrayDesign.getCompositeSequences().clear(); arrayDesign = arrayDesignDao.create(arrayDesign); arrayDesign.getCompositeSequences().addAll(scs); arrayDesign = this.persistArrayDesignCompositeSequenceAssociations(arrayDesign); arrayDesignDao.update(arrayDesign); } finally { this.getSessionFactory().getCurrentSession().setFlushMode(FlushMode.AUTO); } return arrayDesign; }
From source file:ubic.gemma.persistence.persister.ExpressionPersister.java
License:Apache License
@Override @Transactional// w ww. j av a2 s.com public ExpressionExperiment persist(ExpressionExperiment ee, ArrayDesignsForExperimentCache cachedArrays) { if (ee == null) return null; if (!this.isTransient(ee)) return ee; this.clearCache(); ExpressionExperiment existingEE = expressionExperimentDao.findByShortName(ee.getShortName()); if (existingEE != null) { AbstractPersister.log.warn("Expression experiment with same short name exists (" + existingEE + "), returning it (this method does not handle updates)"); return existingEE; } try { AbstractPersister.log.info(">>>>>>>>>> Persisting " + ee); this.getSessionFactory().getCurrentSession().setFlushMode(FlushMode.COMMIT); ee.setPrimaryPublication((BibliographicReference) this.persist(ee.getPrimaryPublication())); ee.setOwner((Contact) this.persist(ee.getOwner())); ee.setTaxon(this.persistTaxon(ee.getTaxon())); this.persistCollectionElements(ee.getQuantitationTypes()); this.persistCollectionElements(ee.getOtherRelevantPublications()); if (ee.getAccession() != null) { this.fillInDatabaseEntry(ee.getAccession()); } // This has to come first and be persisted, so our FactorValues get persisted before we process the // BioAssays. if (ee.getExperimentalDesign() != null) { ExperimentalDesign experimentalDesign = ee.getExperimentalDesign(); experimentalDesign.setId(null); // in case of retry. this.processExperimentalDesign(experimentalDesign); assert experimentalDesign.getId() != null; ee.setExperimentalDesign(experimentalDesign); } this.checkExperimentalDesign(ee); // This does most of the preparatory work. this.processBioAssays(ee, cachedArrays); ee = expressionExperimentDao.create(ee); } finally { this.getSessionFactory().getCurrentSession().setFlushMode(FlushMode.AUTO); } this.clearCache(); AbstractPersister.log.info("<<<<<< FINISHED Persisting " + ee); return ee; }
From source file:ubic.gemma.persistence.persister.ExpressionPersister.java
License:Apache License
@Override public Object persist(Object entity) { if (entity == null) return null; if (entity instanceof ExpressionExperiment) { AbstractPersister.log.warn("Consider doing the 'setup' step in a separate transaction"); this.getSessionFactory().getCurrentSession().setFlushMode(FlushMode.AUTO); ArrayDesignsForExperimentCache c = expressionExperimentPrePersistService .prepare((ExpressionExperiment) entity); return this.persist((ExpressionExperiment) entity, c); } else if (entity instanceof BioAssayDimension) { return this.persistBioAssayDimension((BioAssayDimension) entity, null); } else if (entity instanceof BioMaterial) { return this.persistBioMaterial((BioMaterial) entity); } else if (entity instanceof BioAssay) { return this.persistBioAssay((BioAssay) entity, null); } else if (entity instanceof Compound) { return this.persistCompound((Compound) entity); } else if (entity instanceof ExpressionExperimentSubSet) { return this.persistExpressionExperimentSubSet((ExpressionExperimentSubSet) entity); }// w w w . j ava 2s . c om return super.persist(entity); }
From source file:ubic.gemma.persistence.persister.PersisterHelper.java
License:Apache License
@Override @Transactional/*www .ja v a 2 s. co m*/ public Object persist(Object entity) { try { this.getSessionFactory().getCurrentSession().setFlushMode(FlushMode.COMMIT); if (entity instanceof Auditable) { Auditable auditable = (Auditable) entity; if (auditable.getAuditTrail() == null) { auditable.setAuditTrail(AuditTrail.Factory.newInstance()); } auditable.setAuditTrail(persistAuditTrail(auditable.getAuditTrail())); } return super.persist(entity); } finally { this.getSessionFactory().getCurrentSession().setFlushMode(FlushMode.AUTO); } }
From source file:won.protocol.util.hibernate.FlushModeSettingHibernateJpaDialect.java
License:Apache License
public Object prepareTransaction(EntityManager entityManager, boolean readOnly, String name) throws PersistenceException { Session session = getSession(entityManager); FlushMode currentFlushMode = session.getFlushMode(); FlushMode previousFlushMode = null;/*from w ww.j a v a 2s.c om*/ if (getFlushMode() != null) { session.setFlushMode(flushMode); previousFlushMode = currentFlushMode; } else if (readOnly) { // We should suppress flushing for a read-only transaction. session.setFlushMode(FlushMode.MANUAL); previousFlushMode = currentFlushMode; } else { // We need AUTO or COMMIT for a non-read-only transaction. if (currentFlushMode.lessThan(FlushMode.COMMIT)) { session.setFlushMode(FlushMode.AUTO); previousFlushMode = currentFlushMode; } } return new SessionTransactionData(session, previousFlushMode); }