Package org.hibernate

Examples of org.hibernate.FlushMode


        final List result = new ArrayList();
        try {
            new HibernateTxFragment() {
            protected void txFragment(Session session) throws Exception {
                Query query = session.createQuery(" from " + DataSourceEntry.class.getName());
                FlushMode oldFlushMode = session.getFlushMode();
                session.setFlushMode(FlushMode.COMMIT);
                query.setCacheable(true);
                result.addAll(query.list());
                session.setFlushMode(oldFlushMode);
            }}.execute();
View Full Code Here


        if (name == null) return null;

        final List results = new ArrayList();
        new HibernateTxFragment() {
        protected void txFragment(Session session) throws Exception {
            FlushMode flushMode = session.getFlushMode();
            session.setFlushMode(FlushMode.COMMIT);

            StringBuffer sql = new StringBuffer();
            sql.append("select dse ");
            sql.append("from ").append(DataSourceEntry.class.getName()).append(" as dse ");
View Full Code Here

  public FlushModeType getFlushMode() {
    if ( jpaFlushMode != null ) {
      return jpaFlushMode;
    }
    final FlushMode hibernateFlushMode = session.getFlushMode();
    if ( FlushMode.AUTO == hibernateFlushMode ) {
      return FlushModeType.AUTO;
    }
    else if ( FlushMode.COMMIT == hibernateFlushMode ) {
      return FlushModeType.COMMIT;
View Full Code Here

        new HibernateTxFragment() {
            protected void txFragment(Session session) throws Exception {
                Query query = session.createQuery(" from " + DataSourceTableEntry.class.getName() + " entry where entry.datasource = :datasource");
                query.setString("datasource", datasource);
                query.setCacheable(true);
                FlushMode oldFlushMode = session.getFlushMode();
                session.setFlushMode(FlushMode.COMMIT);
                existingEntries.addAll(query.list());
                session.setFlushMode(oldFlushMode);
            }
        }.execute();
View Full Code Here

        new HibernateTxFragment() {
            protected void txFragment(Session session) throws Exception {
                Query query = session.createQuery(" from " + DataSourceColumnEntry.class.getName() + " entry where entry.datasource = :datasource and entry.tableName = :tableName");
                query.setString("datasource", datasource);
                query.setString("tableName", tableName);
                FlushMode oldFlushMode = session.getFlushMode();
                session.setFlushMode(FlushMode.NEVER);
                query.setCacheable(true);
                existingEntries.addAll(query.list());
                session.setFlushMode(oldFlushMode);
            }
View Full Code Here

   */
  @Override
  public FlushModeType getFlushMode() {
    checkOpen();

    FlushMode mode = internalGetSession().getFlushMode();
    if ( mode == FlushMode.AUTO ) {
      return FlushModeType.AUTO;
    }
    else if ( mode == FlushMode.COMMIT ) {
      return FlushModeType.COMMIT;
View Full Code Here

  public static void bindQuery(org.hibernate.annotations.NamedQuery queryAnn, Mappings mappings) {
    if ( queryAnn == null ) return;
    if ( BinderHelper.isEmptyAnnotationValue( queryAnn.name() ) ) {
      throw new AnnotationException( "A named query must have a name when used in class or package level" );
    }
    FlushMode flushMode;
    flushMode = getFlushMode( queryAnn.flushMode() );

    NamedQueryDefinition query = new NamedQueryDefinitionBuilder().setName( queryAnn.name() )
        .setQuery( queryAnn.query() )
        .setCacheable( queryAnn.cacheable() )
View Full Code Here

      LOG.debugf( "Binding named query: %s => %s", query.getName(), query.getQueryString() );
    }
  }

  private static FlushMode getFlushMode(FlushModeType flushModeType) {
    FlushMode flushMode;
    switch ( flushModeType ) {
      case ALWAYS:
        flushMode = FlushMode.ALWAYS;
        break;
      case AUTO:
View Full Code Here

      }
    }
  }

  public static FlushMode getFlushMode(Object value) {
    FlushMode flushMode = null;
    if (value instanceof FlushMode) {
      flushMode = (FlushMode) value;
    }
    else if (value instanceof javax.persistence.FlushModeType) {
      flushMode = ConfigurationHelper.getFlushMode( (javax.persistence.FlushModeType) value);
View Full Code Here

   * JPA 2.0. This method can then return null.
   * If it returns null, do em.unwrap(Session.class).getFlushMode() to get the
   * Hibernate flush mode
   */
  public FlushModeType getFlushMode() {
    FlushMode mode = getSession().getFlushMode();
    if ( mode == FlushMode.AUTO ) {
      return FlushModeType.AUTO;
    }
    else if ( mode == FlushMode.COMMIT ) {
      return FlushModeType.COMMIT;
View Full Code Here

TOP

Related Classes of org.hibernate.FlushMode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.