I'm a new hibernate user, so first of all I want to say hello to everybody.
I am planning to migrate a large EJB(with Entity Beans) project to Hibernate + Session Beans in WebSphere platform. I first downloaded hibernate a couple of days ago and I'm still trying to understand to understand the basic concepts. I succeeded to migrate a small module of the project to Hibernate and got things working up with WSAD 5 but I still got some questions on my mind. I'd be glas if someone could help me.
1. First one is about obtaining a session factory. I tried to get the session factory from JNDI :
<hibernate-configuration>
<session-factory name="java:comp/env/hibernate/SessionFactory">
<property name="connection.datasource">jdbc/OGRENCI</property>
...
</hibernate-configuration>
Then I defined a resource reference in my Session EJB with the name hibernate/SessionFactory bound to the JNDI name hibernate/SessionFactory and with its type set to javax.resource.cci.ConnectionFactory.
However, the server tries to create a subcontext in the JNDI tree (named hibernate), and throws an UnsupportedOperation exception. I didn't clearly understand what was happening there and what is wrong. So I now get the SessionFactory with a default method call getSessionFactory() without defining anything? Is this allright and preferred way?
2. The second one is about Transaction Managers and other session configuration parameters. I don't know how can I set an ideal configuration to use the app server's CMT. Can someone just write me sample hibernate.cfg.xml file?
3. I set the use_outer_join parameter to true but it produces exceptions with DB2 v 7.2, and does not work. Is there a bug there or am I doing something wrong in my persistency mappings?
4. One more last question is about class-paths in WSAD. Maybe I should post this to IBM mail lists but there may be someone here who knows about such a problem. I used to work without any problems with the project before, but I get the following errors with hibernate..
- I first added these jar files to my ejb project's build path as external jars: cglib-asm.jar, commons-beanutils.jar, commons-collections.jar, commons-lang.jar, commons-logging.jar, dom4j.jar, hibernate2.jar, log4j-1.2.8.jar(I needed this explicitly for my own audit trail module), odmg.jar, xml-apis.jar. I added xerces jar as variable from WebSphere's own installation, namely XERCESJAR.
- I then added all these jar files to my server configuration's path as well
both as ws.ext.dirs and as Class Path entry. However, the server generates the following strange error:
java.lang.NoClassDefFoundError: javax/sql/DataSource
When I add j2ee.jar file as a variable from WAS_PLUGINDIR/lib directory to both ws.ext.dirs and Class Path entry of my server configuration the exception disappears and everything works ok. This seemed a strange behavior to me cause I cannot understand what's happening and why the server cannot find the class without my adding it explicitly to the configuration...
Any answers or comments on these questions will be appreciated much, thanks in advance...
|