Announcement Announcement Module
No announcement yet.
Spring, JPA, JBoss and Shared Data Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring, JPA, JBoss and Shared Data

    Hi All

    I have a working Spring, JPA(using Hibernate) and JBoss app.

    I have broken my project up into 2. One being the Web app, and the other being the Server side (persistence). I drop the serverSide.jar into the web app and deploy the web app to JBoss and everything works great.

    But now, what I need to do is deploy a different Web app, using the same serverSide.jar AND sharing the same data or caching of objects. So basically, I am deploying 2 or more apps all sharing the same data. I would think they would be using the same EntityManager or Caching????

    Is this possible? And if so, how do I go about configuring Spring to do this?

    Any help would be appreciated.
    Jeff Singer

  • #2
    Maybe if I put it slightly differently.

    I am currently using Annotations, EJB3, Hibernate and JBoss. I have a server.jar, that contains my service,DAO and model layer. I deploy this to jboss and I have 3 web apps using JNDI to lookup my Services. This all works fine.

    I would like to move this to Spring. But I do not want to move all my apps into one Web App. So I would like to keep the seperation of the code.

    BUT I still want to share the data across all the apps. As all 3 off them will be adding, deleting and listing data.

    So do I do this via JNDI, caching....etc....

    Any ideas? anyone? Please.



    • #3
      Anybody? Please


      • #4
        AFAIK, cache sharing is not covered by the JPA spec. What you can do is investigate the caching layer of your JPA provider and use that as a starting point. Hibernate uses EhCache so in your case, you could point out both applications to use the same EhCache instance and zones - this way, the same cache area will be used by both apps.
        I have actually ran into this problem a long time ago where the ehcache (which back then created only singleton instances) was shared (w/o us being aware) by multiple webapps. As Hibernate uses the same cache zones by default, we were getting data from one app 'leaking' into the other.
        Very strange but also funny .