I have a number of classes that I wanted to all have share the same setup
for OR Mapping. That way each class could setup its own session and persist
in different ways.
For example:
public void setupHibernate(List mapFiles)
{
try {
Properties hibernateConfig = new Properties();
hibernateConfig.setProperty("connection.url", myvalue);
hibernateConfig.setProperty("show_sql", "false");
hibernateConfig.setProperty("dialect", myDialect);
Configuration myConfig = new Configuration().setProperties(
hibernateConfig );
Properties props = new Properties();
for(Iterator it = mapFiles.iterator(); it.hasNext(); ) {
String mapFile = (String)it.next();
System.out.println(" map file = " + mapFile);
myConfig.addFile( mapFile );
}
_sessionFactory = myConfig.configure().buildSessionFactory();
} catch(Exception e) {
throw new RuntimeException("Hibernate error occured in initial
session opening", e);
}
}
Then I get the following error:
13:58:40,362 INFO Configuration:694 - Configuration resource:
/hibernate.cfg.xml
13:58:40,364 WARN Configuration:698 - /hibernate.cfg.xml not found
ASIAdapter: main: Exception Caught: java.lang.RuntimeException: Hibernate
error occured in initial session \
Opening
Is there a way to not have to use a hibernate.cfg.xml file? I just want to
setup the properties for the sessionfactory on my own.
Earl
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel