Package org.jboss.dashboard.database.hibernate

Examples of org.jboss.dashboard.database.hibernate.HibernateTxFragment


    /**
     * Persist panel status to database
     */
    public synchronized void store(final Panel panel) throws Exception {

        HibernateTxFragment txFragment = new HibernateTxFragment() {
            protected void txFragment(Session session) throws Exception {
                session.saveOrUpdate(panel);
                session.flush();
            }
        };

        synchronized (panel) {
            txFragment.execute();
        }
    }
View Full Code Here


    /**
     * Persist panel status to database
     */
    public synchronized void store(final PanelInstance instance) throws Exception {
        HibernateTxFragment txFragment = new HibernateTxFragment() {
            protected void txFragment(Session session) throws Exception {
                session.saveOrUpdate(instance);
            }
        };
        synchronized (instance) {
            txFragment.execute();
        }
    }
View Full Code Here

        }
    }

    public Panel getPaneltByDbId(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();
View Full Code Here

        return null;
    }

    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();
View Full Code Here

        return null;
    }

    public Set<PanelInstance> getPanelsByParameter(final String paramId, final String value) throws Exception {
        final Set<PanelInstance> results = new HashSet<PanelInstance>();
        new HibernateTxFragment() {
        protected void txFragment(Session session) throws Exception {
            FlushMode flushMode = session.getFlushMode();
            session.setFlushMode(FlushMode.COMMIT);

            StringBuffer sql = new StringBuffer();
View Full Code Here

        return null;
    }

    protected void initConnection() {
        try {
            new HibernateTxFragment() {
            protected void txFragment(Session session) throws Exception {
                log.debug("Obtain data source connection: " + name);
                // Bug Fix: under some circumstances, the dataSourceEntry attribute became out of sync with the Hibernate session.
                dataSourceEntry = (DataSourceEntry) session.get(dataSourceEntry.getClass(), dataSourceEntry.getDbid());
                Connection conn = dataSourceEntry.getConnection();
View Full Code Here

     * Get all registered datasource entries
     */
    public List<DataSourceEntry> getDataSourceEntries() {
        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);
View Full Code Here

    public DataSourceEntry getDataSourceEntryByName(final String name) throws Exception {
        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();
View Full Code Here

        if (ds != null) return ds;

        // Search the data source with the given name into the database.
        final DataSourceEntry[] entryResult = new DataSourceEntry[] {null};
        try {
            new HibernateTxFragment() {
            protected void txFragment(Session session) throws Exception {
                Query query = session.createQuery(" from " + DataSourceEntry.class.getName() + " entry where entry.name = :entryName ");
                FlushMode oldFlushMode = session.getFlushMode();
                session.setFlushMode(FlushMode.COMMIT);
                query.setString("entryName", name);
View Full Code Here

        }
    }

    protected void processTheRequest(final HttpServletRequest request, final HttpServletResponse response) {
        try {
            new HibernateTxFragment() {
            protected void txFragment(Session session) throws Exception {
                // Process the request.
                if (log.isDebugEnabled()) log.debug("Processing request\n" + Profiler.printCurrentContext());
                RequestChainProcessor requestProcessor = (RequestChainProcessor) Factory.lookup("org.jboss.dashboard.ui.controller.requestChain.StartingProcessor");
                requestProcessor.doRequestProcessing();
View Full Code Here

TOP

Related Classes of org.jboss.dashboard.database.hibernate.HibernateTxFragment

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.