Example usage for org.hibernate FlushMode AUTO

List of usage examples for org.hibernate FlushMode AUTO

Introduction

In this page you can find the example usage for org.hibernate FlushMode AUTO.

Prototype

FlushMode AUTO

To view the source code for org.hibernate FlushMode AUTO.

Click Source Link

Document

The Session is sometimes flushed before query execution in order to ensure that queries never return stale state.

Usage

From source file:dados.hibernate.GestorMusicaPersistentManager.java

private GestorMusicaPersistentManager() throws PersistentException {
    super(_connectionSetting, _sessionType, _timeToAlive, new String[] {}, _extraProperties,
            _configurationFile);/*w  ww .jav a  2  s. c  o  m*/
    setFlushMode(FlushMode.AUTO);
}

From source file:dao.DaoCommande.java

@Override
public void insert(Metier objet) {
    System.out.println(objet);/*ww w  .  j ava2  s.  c  o  m*/
    Session session = getHibernateTemplate().getSessionFactory().openSession();
    session.setFlushMode(FlushMode.AUTO);
    session.save(objet);
    session.flush();

}

From source file:de.fhb.jproject.data.JProjectPersistentManager.java

private JProjectPersistentManager() throws PersistentException {
    super(_connectionSetting, _sessionType, _timeToAlive, new String[] {}, _extraProperties);
    setFlushMode(FlushMode.AUTO);
}

From source file:de.iteratec.iteraplan.persistence.elasticeam.metamodel.IteraplanMetamodelDifferentialWriter.java

License:Open Source License

private void updateEnumLiteral(MMChange<EnumerationLiteralExpression> change) {
    AttributeValueService attributeValueService = (AttributeValueService) DefaultSpringApplicationContext
            .getSpringApplicationContext().getBean("attributeValueService");
    AttributeTypeService attributeTypeService = (AttributeTypeService) DefaultSpringApplicationContext
            .getSpringApplicationContext().getBean("attributeTypeService");
    if (change.getChangeKind() == MMChangeKind.ADD) {
        EnumAT enumAT = this.mapping.getAdditionalEnumerationExpressions()
                .get(change.getAffectedElement().getOwner());
        EnumAV enumAV = new EnumAV();
        enumAV.setAttributeTypeTwoWay(enumAT);
        enumAV.setDescription(change.getAffectedElement().getDescription());
        enumAV.setName(change.getAffectedElement().getPersistentName());
        attributeValueService.saveOrUpdate(enumAV);
        attributeTypeService.merge(enumAT);
    } else if (change.getChangeKind() == MMChangeKind.DELETE) {
        //TODO mba: remove this hack..
        EnumAV enumAV = this.mapping.getAdditionalEnumerationLiterals().get(change.getAffectedElement());
        enumAV.getAttributeType().getAttributeValues().remove(enumAV);
        SessionFactory factory = (SessionFactory) DefaultSpringApplicationContext.getSpringApplicationContext()
                .getBean("sessionFactory");
        FlushMode before = factory.getCurrentSession().getFlushMode();
        factory.getCurrentSession().setFlushMode(FlushMode.AUTO);
        Session session = factory.getCurrentSession();
        Transaction transaction = session.beginTransaction();
        attributeValueService.deleteEntity(enumAV);
        transaction.commit();/* w  ww . ja  v  a2  s .  c om*/
        factory.getCurrentSession().setFlushMode(before);
    }
}

From source file:diagrama_bd.base_de_datos.ProyectoCompletoIluminatiPersistentManager.java

private ProyectoCompletoIluminatiPersistentManager() throws PersistentException {
    super(_connectionSetting, _sessionType, _timeToAlive, new String[] {}, _extraProperties,
            _configurationFile);/*from w ww .  j  av  a  2  s  .co  m*/
    setFlushMode(FlushMode.AUTO);
}

From source file:diagrama_de_base_de_datos.ProyectoMDS2PersistentManager.java

private ProyectoMDS2PersistentManager() throws PersistentException {
    super(_connectionSetting, _sessionType, _timeToAlive, new String[] {}, _extraProperties,
            _configurationFile);/*from   w w w . j a  v  a 2 s .c  om*/
    setFlushMode(FlushMode.AUTO);
}

From source file:domain.model.RSPersistentManager.java

private RSPersistentManager() throws PersistentException {
    super(_connectionSetting, _sessionType, _timeToAlive, new String[] {}, _extraProperties,
            _configurationFile);//from w  w  w.  ja v  a2  s  .  c om
    setFlushMode(FlushMode.AUTO);
}

From source file:edu.mgupi.pass.db.surfaces.PassPersistentManager.java

private PassPersistentManager() throws PersistentException {
    super(_connectionSetting, _sessionType, _timeToAlive, new String[] {}, _extraProperties);
    setFlushMode(FlushMode.AUTO);
}

From source file:entity.ProvaSVNPersistentManager.java

private ProvaSVNPersistentManager() throws PersistentException {
    super(_connectionSetting, _sessionType, _timeToAlive, new String[] {}, _extraProperties);
    setFlushMode(FlushMode.AUTO);
}

From source file:Entity.ServerPersistentManager.java

private ServerPersistentManager() throws PersistentException {
    super(_connectionSetting, _sessionType, _timeToAlive, new String[] {}, _extraProperties);
    setFlushMode(FlushMode.AUTO);
}