You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by ep...@apache.org on 2003/08/24 21:52:50 UTC

cvs commit: jakarta-turbine-fulcrum/security/src/test/org/apache/fulcrum/security/spi/hibernate HibernateHelper.java

epugh       2003/08/24 12:52:50

  Added:       security/src/test/org/apache/fulcrum/security/spi/hibernate
                        HibernateHelper.java
  Log:
  Little helper to generate DDL
  
  Revision  Changes    Path
  1.1                  jakarta-turbine-fulcrum/security/src/test/org/apache/fulcrum/security/spi/hibernate/HibernateHelper.java
  
  Index: HibernateHelper.java
  ===================================================================
  /*
   * Created on Aug 23, 2003
   *
   */
  package org.apache.fulcrum.security.spi.hibernate;
  import net.sf.hibernate.SessionFactory;
  import net.sf.hibernate.cfg.Configuration;
  import net.sf.hibernate.tool.hbm2ddl.SchemaExport;
  /**
   * @author Eric Pugh
   *
   * This class allows us to dynamically populate the hsql database with our schema.
   */
  public class HibernateHelper
  {
      private static SessionFactory sessions;
      /**
       * @return
       */
      public static SessionFactory getSessions()
      {
          return sessions;
      }
  
      public static void exportSchema(Configuration cfg) throws Exception
      {
          
          new SchemaExport(cfg).create(true, true);
          sessions = cfg.buildSessionFactory();
      }
  }