I am having a problem in building the SessionFactory for Hibernate 3.0
This is the code i wrote:
//Configure hibernate
org.hibernate.cfg.Configuration Config =
new org.hibernate.cfg.Configuration();
Config.setProperties(properties);
StringTokenizer st = new StringTokenizer
(properties.getProperty("waterdonate.persistant"), ",");
while (st.hasMoreTokens()) {
String currentToken = st.nextToken();
try {
Config.addClass(Class
.forName(currentToken.trim()));
} catch (ClassNotFoundException e) {
logger.error("Can not find class " + currentToken, e);
} catch (org.hibernate.MappingException e) {
logger.error("Can not find map for class " + currentToken, e);
}
}
try {
Waterdonate.setSessionFactory(Config.buildSessionFactory()); logger.info("Hibernate configured successfully");
} catch (org.hibernate.HibernateException e) {
logger.fatal("Could not create Hibernate SessionFactory", e);
return;
}
I am getting errors of this kind
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1881)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1174)
at com.waterdonate.configuration.WaterdonateConfigurator.configure(WaterdonateConfigurator.java:141)
at com.waterdonate.configuration.WaterdonateConfigurator.init(WaterdonateConfigurator.java:60)
Waterdonate is my DB.
help me to solve the code at this place
Waterdonate.setSessionFactory(Config.buildSessionFactory()); logger.info("Hibernate configured successfully");
thanks in advance
dan
|