public class ConfigurationClass
{
private static SessionFactory sf;
private static final Properties properties;
static
{
properties = new Properties();
properties.setProperty("hibernate.connection.driver_class", "oracle.jdbc.driver.OracleDriver");
properties.setProperty("hibernate.connection.url", "jdbc:oracle:thin:@localhost:1521:xe");
properties.setProperty("hibernate.connection.username", "sql");
properties.setProperty("hibernate.connection.password", "sql");
properties.setProperty("hibernate.show_sql", "true");
properties.setProperty("hibernate.dialect", "org.hibernate.dialect.Oracle9Dialect");
sf = new AnnotationConfiguration().setProperties(properties).addAnnotatedClass(Employee.class).buildSessionFactory();
}
private ConfigurationClass()
{
}
public static SessionFactory getSessionFactoryObject()
{
if (sf != null)
{
return sf;
}
return new AnnotationConfiguration().setProperties(properties).addAnnotatedClass(Employee.class).buildSessionFactory();
}
}
{
private static SessionFactory sf;
private static final Properties properties;
static
{
properties = new Properties();
properties.setProperty("hibernate.connection.driver_class", "oracle.jdbc.driver.OracleDriver");
properties.setProperty("hibernate.connection.url", "jdbc:oracle:thin:@localhost:1521:xe");
properties.setProperty("hibernate.connection.username", "sql");
properties.setProperty("hibernate.connection.password", "sql");
properties.setProperty("hibernate.show_sql", "true");
properties.setProperty("hibernate.dialect", "org.hibernate.dialect.Oracle9Dialect");
sf = new AnnotationConfiguration().setProperties(properties).addAnnotatedClass(Employee.class).buildSessionFactory();
}
private ConfigurationClass()
{
}
public static SessionFactory getSessionFactoryObject()
{
if (sf != null)
{
return sf;
}
return new AnnotationConfiguration().setProperties(properties).addAnnotatedClass(Employee.class).buildSessionFactory();
}
}
No comments:
Post a Comment