-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: objects arent updated
PostPosted: Mon Feb 16, 2004 3:32 pm 
Newbie

Joined: Thu Feb 12, 2004 2:45 pm
Posts: 4
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


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 16, 2004 3:35 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Sorry can't help you about the Resin part but - Using different SessionFactorys should not be a problem. Have you checked your updates get through to the database? If not, check if you are flushing and committing properly ...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.