//
private HibernateUtil() {
}
protected static boolean initialize() {
IApplicationContext applicationContext = PentahoSystem.getApplicationContext();
// Add to entry/exit points list
HibernateUtil hUtil = new HibernateUtil();
applicationContext.addEntryPointHandler( hUtil );
applicationContext.addExitPointHandler( hUtil );
// Look for some hibernate-specific properties...
String hibernateConfigurationFile = lookupSetting( applicationContext, "hibernateConfigPath", //$NON-NLS-1$
"settings/config-file", //$NON-NLS-1$
"hibernate/hibernateConfigPath" ); //$NON-NLS-1$
String hibernateManagedString = lookupSetting( applicationContext, "hibernateManaged", //$NON-NLS-1$
"settings/managed", //$NON-NLS-1$
"hibernate/hibernateManaged" ); //$NON-NLS-1$
if ( hibernateManagedString != null ) {
hibernateManaged = Boolean.parseBoolean( hibernateManagedString );
}
try {
HibernateUtil.configuration = new Configuration();
HibernateUtil.configuration.setEntityResolver( new PentahoEntityResolver() );
HibernateUtil.configuration.setListener( "load", new HibernateLoadEventListener() ); //$NON-NLS-1$
if ( hibernateConfigurationFile != null ) {
String configPath = applicationContext.getSolutionPath( hibernateConfigurationFile );
File cfgFile = new File( configPath );
if ( cfgFile.exists() ) {
HibernateUtil.configuration.configure( cfgFile );
} else {
HibernateUtil.log.error( Messages.getInstance().getErrorString(