Package com.darkhonor.rage.libs.dataaccess

Examples of com.darkhonor.rage.libs.dataaccess.VersionDAO


            if (emf.isOpen())
            {
                // Verify the Application version is compatible with the database
                EntityManager em = emf.createEntityManager();
                LOGGER.debug("Comparing the version of the database to the App");
                VersionDAO versionDAO = new VersionDAO(em);
                if (versionDAO.checkDbVersion(version))
                {
                    try
                    {
                        LOGGER.debug("Creating EntifyManagerFactory");
                        LOGGER.debug("EntityManagerFactory created.  Starting threads");
View Full Code Here


    private void checkVersion(boolean createSchema)
    {
        try
        {
            LOGGER.debug("(checkVersion) Creating VersionDAO object");
            VersionDAO versionDAO = new VersionDAO(emf.createEntityManager());
            LOGGER.debug("(checkVersion) VersionDAO object created");
            // If this is a new install and the option to create the database
            // schema is set, do so here
            if (createSchema)
            {
                // Insert the version number in the database
                LOGGER.debug("We created schema...Version stored on connect");
                versionDAO.create(version);
//                    EntityTransaction tx = em.getTransaction();
//                    tx.begin();
//                    em.persist(version);
//                    tx.commit();
            } else
            {
                LOGGER.debug("Schema not created.");
            }
            if (versionDAO.checkDbVersion(version))
            {
                LOGGER.debug("(checkVersion) Database version matches "
                        + "application version.");
            } else
            {
                LOGGER.error("(checkVersion) Database version does not match. "
                        + "Exiting program.");
                JOptionPane.showMessageDialog(this, "ERROR: This version of "
                        + "JTestGen is not compatible with the RAGE database. "
                        + "Exiting program.",
                        "ERROR", JOptionPane.ERROR_MESSAGE);
                exitMenuItemActionPerformed(null);
            }
            LOGGER.debug("(checkVersion) Closing VersionDAO connection");
            versionDAO.closeConnection();
        } catch (IllegalStateException ex)
        {
            LOGGER.warn("(checkVersion) Problem connecting to the database "
                    + "with the VersionDAO object");
        }
View Full Code Here

            if (emf.isOpen())
            {
                // Verify the Application version is compatible with the database
                EntityManager em = emf.createEntityManager();
                LOGGER.debug("Comparing the version of the database to the App");
                VersionDAO versionDAO = new VersionDAO(em);
                if (versionDAO.checkDbVersion(version))
                {
                    try
                    {
                        int i = 1;
                        ServerSocket srv_sock = new ServerSocket(port);
View Full Code Here

    private void checkVersion()
    {
        try
        {
            LOGGER.debug("(checkVersion) Creating VersionDAO object");
            VersionDAO versionDAO = new VersionDAO(emf.createEntityManager());
            LOGGER.debug("(checkVersion) VersionDAO object created");
            if (versionDAO.checkDbVersion(version))
            {
                LOGGER.debug("(checkVersion) Database version matches "
                        + "application version.");
            } else
            {
                LOGGER.error("(checkVersion) Database version does not match. "
                        + "Exiting program.");
                JOptionPane.showMessageDialog(CourseGraderApp.getApplication()
                        .getMainFrame(),
                        "ERROR: This version of CourseGrader is "
                        + "not compatible with the RAGE database. Exiting program.",
                        "ERROR", JOptionPane.ERROR_MESSAGE);
                this.exitApplication();
            }
            LOGGER.debug("(checkVersion) Closing VersionDAO connection");
            versionDAO.closeConnection();
        } catch (IllegalStateException ex)
        {
            LOGGER.warn("(checkVersion) Problem connecting to the database "
                    + "with the VersionDAO object");
        }
View Full Code Here

        {
            LOGGER.error("Illegal Argument: EntityManager is null");
            throw new IllegalArgumentException("EntityManager is null");
        } else
        {
            VersionDAO versionDAO = new VersionDAO(em);
            try
            {
                boolean result = versionDAO.checkDbVersion(appVersion);
                versionDAO.closeConnection();
                return result;
            }
            catch (IllegalStateException ex)
            {
                LOGGER.error("Illegal Database State.  EntityManager is closed");
View Full Code Here

    private void checkVersion(boolean createSchema)
    {
        try
        {
            LOGGER.debug("(checkVersion) Creating VersionDAO object");
            VersionDAO versionDAO = new VersionDAO(emf.createEntityManager());
            LOGGER.debug("(checkVersion) VersionDAO object created");
            // If this is a new install and the option to create the database
            // schema is set, do so here
            if (createSchema)
            {
                // Insert the version number in the database
                LOGGER.debug("(checkVersion) We created schema...Version stored "
                        + "on connect");
                versionDAO.create(version);
            } else
            {
                LOGGER.debug("(checkVersion) Schema not created.");
            }
            if (versionDAO.checkDbVersion(version))
            {
                LOGGER.debug("(checkVersion) Database version matches "
                        + "application version.");
            } else
            {
                LOGGER.error("(checkVersion) Database version does not match. "
                        + "Exiting program.");
                JOptionPane.showMessageDialog(JCourseManagementApp.getApplication()
                        .getMainFrame(), "ERROR: This version of "
                        + "JCourseManagements is not compatible with the RAGE "
                        + "database. Exiting program.",
                        "ERROR", JOptionPane.ERROR_MESSAGE);
                exitApplication();
            }
            LOGGER.debug("(checkVersion) Closing VersionDAO connection");
            versionDAO.closeConnection();
        } catch (IllegalStateException ex)
        {
            LOGGER.warn("(checkVersion) Problem connecting to the database "
                    + "with the VersionDAO object");
        }
View Full Code Here

TOP

Related Classes of com.darkhonor.rage.libs.dataaccess.VersionDAO

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.