Package org.hibernate

Examples of org.hibernate.FlushMode


    mappings.addQuery( queryAnn.name(), query );
    if ( log.isInfoEnabled() ) log.info( "Binding named query: " + queryAnn.name() + " => " + queryAnn.query() );
  }

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


      throwPersistenceException( he );
    }
  }

  public FlushModeType getFlushMode() {
    FlushMode mode = getSession().getFlushMode();
    if ( mode == FlushMode.AUTO ) {
      this.flushModeType = FlushModeType.AUTO;
    }
    else if ( mode == FlushMode.COMMIT ) {
      this.flushModeType = FlushModeType.COMMIT;
View Full Code Here

  @Override
  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

   * 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

    public WorkspaceImpl[] getWorkspaces() {
        final List<WorkspaceImpl> workspaces = new ArrayList<WorkspaceImpl>();

        HibernateTxFragment txFragment = new HibernateTxFragment() {
            protected void txFragment(Session session) throws Exception {
                FlushMode oldFlushMode = session.getFlushMode();
                session.setFlushMode(FlushMode.NEVER);
                Query q = session.createQuery(" from " + WorkspaceImpl.class.getName());
                q.setCacheable(true);
                workspaces.addAll(q.list());
                session.setFlushMode(oldFlushMode);
View Full Code Here

    public Workspace getWorkspaceByUrl(final String url) throws Exception {
        final Workspace[] workspace = new Workspace[1];
        new HibernateTxFragment() {
            protected void txFragment(Session session) throws Exception {
                FlushMode oldFlushMode = session.getFlushMode();
                session.setFlushMode(FlushMode.NEVER);
                Query q = session.createQuery(" from " + WorkspaceImpl.class.getName() + " p where p.friendlyUrl = :url");
                q.setString("url", url);
                q.setCacheable(true);
                List l = q.list();
View Full Code Here

    public Panel getPaneltByDbId(final Long panelId) throws Exception {
        if (panelId != 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 p ");
                sql.append("from ").append(Panel.class.getName()).append(" as p ");
View Full Code Here

    public Panel getPaneltById(final Long panelId) throws Exception {
        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 p ");
            sql.append("from ").append(Panel.class.getName()).append(" as p ");
View Full Code Here

        final Set<PanelInstance> results = new HashSet<PanelInstance>();
        if(value == null || paramId == null) return results;

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

            StringBuffer sql = new StringBuffer();
            sql.append("select p ");
            sql.append("from ").append(PanelInstance.class.getName()).append(" as p join p.panelParams as param ");
View Full Code Here

        if (dbid == null) return null;

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

            StringBuffer sql = new StringBuffer();
            sql.append("select item ");
            sql.append("from ").append(Section.class.getName()).append(" as item ");
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.