Package org.jboss.dashboard.database.hibernate

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


    }

    protected void beforePanelInstanceRemove(final PanelInstance instance) throws Exception {
        super.beforePanelInstanceRemove(instance);

        new HibernateTxFragment() {
        protected void txFragment(Session session) throws Exception {
            HTMLText htmlText = load(instance);
            if (htmlText != null) htmlText.delete();
        }}.execute();
    }
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);
View Full Code Here

            return;
        }

        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);
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

     * Executes this fragment.
     *
     * @throws Exception
     */
    public void execute() throws Exception {
        new HibernateTxFragment() {
        protected void txFragment(Session session) throws Exception {
            DataSource dataSource = getDataSource();
            if (dataSource == null) {
                noDataSource();
            } else {
View Full Code Here

            if (ArrayUtils.contains(excludedScriptStatements, ddlStatement)) {
                continue;
            }

            if (log.isDebugEnabled()) log.debug("Running statement: " + ddlStatement);
            new HibernateTxFragment() {
            protected void txFragment(Session session) throws Exception {
                Work w = new Work() {
                public void execute(Connection connection) throws SQLException {
                    Statement statement = null;
                    try {
View Full Code Here

        return sb.toString().trim();
    }

    protected boolean existsModulesTable(final String databaseName) throws Exception {
        final boolean[] returnValue = {false};
        new HibernateTxFragment(true) {
        protected void txFragment(Session session) throws Exception {
            Work w = new Work() {
            public void execute(Connection connection) throws SQLException {
                DatabaseMetaData metaData = connection.getMetaData();
                ResultSet resultLowcase = metaData.getTables(null, null, installedModulesTable.toLowerCase(), null);
View Full Code Here

    public boolean doTheInstall() {
        final boolean [] returnvalue = new boolean[]{false};
        if (installTransactional) {
            try {
                new HibernateTxFragment() {
                    protected void txFragment(Session session) throws Exception {
                        returnvalue[0] = install();
                    }
                }.execute();
            } catch (Exception e) {
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.