]> SALOME platform Git repositories - tools/siman.git/blobdiff - Workspace/Siman-Common/src/org/splat/dal/dao/kernel/Database.java
Salome HOME
Refactoring of Database, replacing SQL by DAOs calls. Methods for search by criteria...
[tools/siman.git] / Workspace / Siman-Common / src / org / splat / dal / dao / kernel / Database.java
index 9ebba991a994d7316a302023ef0c991480170b8f..08642029c5841b005420e2179093d61bd052806c 100644 (file)
@@ -5,16 +5,11 @@ package org.splat.dal.dao.kernel;
  * @copyright OPEN CASCADE 2012
  */
 
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.sql.Statement;
 import org.hibernate.Session;
 import org.hibernate.SessionFactory;
-import org.hibernate.jdbc.Work;
 import org.springframework.beans.BeansException;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.ApplicationContextAware;
-import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
 import org.apache.log4j.Logger;
 
 
@@ -45,73 +40,6 @@ public abstract class Database implements ApplicationContextAware {
 //     private   static  String          CONFIG_FILE      = "/hibernate.cfg.xml";
     private   static  SessionFactory  mySessionFactory = null;
 
-    protected class CreateTables    implements Work {
-//  -----------------------------------------------
-      protected Statement request;
-      
-      public void execute(Connection connex) throws SQLException
-      {          
-        request = connex.createStatement();
-
-//      Last identifier of Any objects
-        String create = "CREATE TABLE `any` (" +
-          "`rid`     int(10)  UNSIGNED NOT NULL," +
-          "`version` tinytext NOT NULL," +
-          "PRIMARY KEY (`rid`)" +
-          ") ENGINE=MyISAM DEFAULT CHARSET=latin1";
-        request.execute(create);
-
-//      Relation from entities
-        create = "CREATE TABLE `relation` (" +
-          "`rid`   int(10)  UNSIGNED NOT NULL," +
-          "`name`  tinytext NOT NULL," +
-          "`owner` int(10)  NOT NULL," +
-          "`refer` int(10)  NOT NULL," +
-          "PRIMARY KEY (`rid`)" +
-          ") ENGINE=MyISAM DEFAULT CHARSET=latin1";
-        request.execute(create);
-
-//      Attribute objects
-        create = "CREATE TABLE `attribute` (" +
-          "`rid`   int(10)  UNSIGNED NOT NULL auto_increment," +
-          "`type`  tinytext NOT NULL," +
-          "`owner` int(10)  NOT NULL," +
-          "`value` int(10)  NOT NULL," +
-          "PRIMARY KEY (`rid`)" +
-          ") ENGINE=MyISAM DEFAULT CHARSET=latin1";
-        request.execute(create);
-
-//      Java String objects
-        create = "CREATE TABLE `text` (" +
-          "`rid`   int(10)  UNSIGNED NOT NULL auto_increment," +
-          "`value` longtext NOT NULL," +
-          "PRIMARY KEY (`rid`)" +
-          ") ENGINE=MyISAM DEFAULT CHARSET=latin1";
-        request.execute(create);
-
-//      User and role objects
-        create = "CREATE TABLE `user` (" +
-          "`rid` int(10) UNSIGNED NOT NULL auto_increment," +
-          "`username` varchar(32) NOT NULL," +
-          "`password` varchar(32)," +
-          "`first`    tinytext NOT NULL," +
-          "`last`     tinytext NOT NULL," +
-          "`display`  tinytext," +
-          "`email`    tinytext," +
-          "`organid`  tinytext," +
-          "PRIMARY KEY (`rid`)" +
-          ") ENGINE=MyISAM DEFAULT CHARSET=latin1";
-        request.execute(create);
-
-        create = "CREATE TABLE `role` (" +
-          "`username` varchar(32) NOT NULL," +
-          "`role`     varchar(32) NOT NULL," +
-          "PRIMARY KEY (`username`)" +
-          ") ENGINE=MyISAM DEFAULT CHARSET=latin1";
-        request.execute(create);
-      }        
-    }
-
     protected final static Logger   logger = Logger.getLogger(Database.class);
     
 //  ==============================================================================================================================