title: Loading information using Hibernate
body: <p>I have a class that is managing my data model that also contains the code that manages the Hibernate connection to store the data as a SQLite database (using a custom Dialect)</p>
  
  <pre><code>@Entity
  @Table
  public class PFSRegion {
  
  @Id
  private String regionName;
  private String location;
  private ArrayList&lt;Scenario&gt; scenarioList = new ArrayList&lt;Scenario&gt;();
  private ArrayList&lt;Venue&gt; venues = new ArrayList&lt;Venue&gt;();
  private ArrayList&lt;Player&gt; players = new ArrayList&lt;Player&gt;();
  private ArrayList&lt;Session&gt; sessions = new ArrayList&lt;Session&gt;();
  
  //hibernate vars
  private Configuration config;
  private SessionFactory sessionFactory;
  
  public PFSRegion(String fileName)
  {
      configHibernate(fileName);
      .....
  }
  
  ...
  
  private void configHibernate(String fileName)
  {
  
      if(!(fileName.endsWith(".rgn")))
      {
          fileName += ".rgn";
      }
  
      //set up hibernate
      config = new Configuration()
          .addAnnotatedClass(com.philderbeast.paizolib.Event.class)
          .addAnnotatedClass(com.philderbeast.paizolib.Player.class)
          .addAnnotatedClass(com.philderbeast.paizolib.Scenario.class)
          .addAnnotatedClass(com.philderbeast.paizolib.Session.class)
          .addAnnotatedClass(com.philderbeast.paizolib.Venue.class)
          .setProperty("hibernate.dialect", "org.hibernate.dialect.SQLiteDialect")
          .setProperty("hibernate.connection.driver_class", "org.sqlite.JDBC")
          .setProperty("hibernate.connection.url", "jdbc:sqlite:" + fileName)
          .setProperty("hibernate.hbm2ddl.auto", "update");
  
      sessionFactory = config.buildSessionFactory();
  }
  </code></pre>
  
  <p>What I'm looking to do is load the <code>regionName</code> and <code>location</code> variables in the constructor when I'm loading from an existing database however im not having any success at finding a way of doing this.</p>
  
  <p>any help would be appreciated</p>