Hibernate OSGI with custom directory for configuration
Hibernate 4.2.3 with OSGI support, that's a very good news and i have
successfully integrated it into my application. But the
OSGISessionFactoryService only searching for the configuration file
"hibernate.cfg.xml" in default directory of the "requestingBundle", e.g
the root directory of the bundle. Let take an example
I have a bundle com.example.a of which the directory look like :
com.example.a
|__src>
| |__com.example.a.model
| |__(other packages)
|__hibernate.cfg.xml
This will work. But i want to put the hibernate.cfg.xml into a folder
,such as /Configuration/hibernate.cfg.xml , so how can i make it when
inside the source code of the OSGISessionFactoryService i don't see where
i can do. Here is the method that's create the SessionFactory (notice the
#4 line)
@Override
public Object getService(Bundle requestingBundle, ServiceRegistration
registration) {
osgiClassLoader.addBundle( requestingBundle );
Configuration configuration = new Configuration();
configuration.getProperties().put(
AvailableSettings.JTA_PLATFORM, osgiJtaPlatform );
configuration.configure();
........
return configuration.buildSessionFactory(serviceRegistry);
}
No comments:
Post a Comment