Package org.hibernate

Examples of org.hibernate.FlushMode


        final HTMLText[] textArray = new HTMLText[1];
        try {
            new HibernateTxFragment() {
            protected void txFragment(Session session) throws Exception {
                log.debug("Getting text to duplicate for instance " + src.getDbid());
                FlushMode oldMode = session.getFlushMode();
                session.setFlushMode(FlushMode.COMMIT);//Avoids flushing, as we know the text was not modified in this transaction.
                textArray[0] = load(src);
                session.setFlushMode(oldMode);
                log.debug("Got text to duplicate for instance " + src.getDbid());
            }}.execute();
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

    public Set getAllKPIs() throws Exception {
        final Set results = new HashSet();
        new HibernateTxFragment() {
        protected void txFragment(Session session) throws Exception {
            FlushMode flushMode = session.getFlushMode();
            session.setFlushMode(FlushMode.COMMIT);
            Query query = session.createQuery("from " + KPIImpl.class.getName() + " order by id");
            query.setCacheable(true);
            results.addAll(query.list());
            session.setFlushMode(flushMode);
View Full Code Here

    public KPI getKPIById(final Long id) 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("from ").append(KPIImpl.class.getName()).append(" as instance ");
            sql.append("where instance.id = :id");
View Full Code Here

    public KPI getKPIByCode(final String code) 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("from ").append(KPIImpl.class.getName()).append(" as instance ");
            sql.append("where instance.code = :code");
View Full Code Here

    public HTMLText load(final PanelInstance instance) {
        final List results = new ArrayList();
        try {
            new HibernateTxFragment() {
            protected void txFragment(Session session) throws Exception {
                FlushMode oldFlushMode = session.getFlushMode();
                session.setFlushMode(FlushMode.NEVER);
                Query query = session.createQuery(" from " + HTMLText.class.getName() + " as text where text.panelInstance = :instance");
                query.setParameter("instance", instance);
                query.setCacheable(true);
                results.addAll(query.list());
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

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

        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

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.