hi.
I have the following scenary:
There are to applications(app1, a forum system and app2, the forum administration). The two applications have the same datasource. If I create a new object(eg. a new forum) with app2, the changes are visible in app1, but I modify an object, instead of creating it, the changes arent reflected. I have checked that the applications arent using the same sessionfactory instance, so I try to get it from the jndi, so I have(I'm using resin):
in the resin.conf:
Code:
<resource-ref>
<res-ref-name>java:comp/forums</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<init-param driver-name="org.postgresql.Driver"/>
<init-param url="jdbc:postgresql://localhost/foros"/>
<init-param user="user"/>
<init-param password=""/>
</resource-ref>
<resource jndi-name="java:comp/env/hibernate">
<type>net.sf.hibernate.jca.ManagedConnectionFactoryImpl</type>
<init>
<dialect>net.sf.hibernate.dialect.PostgreSQLDialect</dialect>
<driver-class>org.postgresql.Driver</driver-class>
<connection-url>jdbc:postgresql://localhost/foros</connection-url>
</init>
</resource>
in the hibernate.properties:
Code:
hibernate.connection.datasource=java:comp/forums
hibernate.session_factory_name=java:comp/env/hibernate
and thats the piece of code I use to get the sessionfactory instance:
Code:
InitialContext ic = new InitialContext();
SessionFactory sessionFactory = (SessionFactory)ic.lookup("java:comp/env/hibernate");
_session = sessionFactory.openSession();
the problem is that sessionFactory points to null and get an exception.
I have searched through the forum, but with no luck.
anyone was able to share the sessions through the jndi using eclipse?
thanx in advance