1 Reply Latest reply on Nov 24, 2007 2:54 PM by Pete Muir

    Persistence provider suggestions needed.

    tzman Newbie


      We have implemented a Custom JPA EntityManager, yes we are either "masochists and/or not very bright". The real reason behind this endeavor is that operations on entities (CRUD) actually occurs via xml messaging with a number of services. So, the EntityManager manages creation of the correct message for the operation called on the given entity. For the most part, implementing the JPA spec made sense. Developers can work with either our EntityManager or the one provided by Hibernate with little transition time. However, there were some things that did not correlate properly to what we needed and we did not want to force something that may end up confusing to developers. Queries were the first thing, and are simply just not supported. Transactions are a little stranger, the concept is somewhat the same but different enough that using the Transaction API would be confusing. So what we have instead is a Bundle, a bundle conceptually works the same as a transaction but differs in that what we are actually doing is sending a number of XML messages "bundled" into a wrapper message. The receiving service will then perform the operations within a single transaction. This all works pretty well, so far.

      Now we are to the point of integrating this with Seam. So, we have an EntityManagerFactory, an EntityManager and a Session ( yes, we modeled this after Hibernate; does that make us genius' ). What we do not have is a persistence unit, which does not really map to a host and port number. What we would like to do is have Seam manage the EntityManager/Session and possibly the Bundles.

      Our thoughts are that we may have to wrap our Bundle in a transaction implementation for either JPA or Hibernate. But, we are not sure if we can get around not having a persistence unit defined. We are slo unsure if we can try to mirror the Hibernate managed context in Seam or if we need to implement all of the JPA requirements and have Seam manage the JPA persistence provider. What is the easiest and/or best way to do this?

      Any suggestions, pointers or comments are appreciated.



      Thanks in advance.

        • 1. Re: Persistence provider suggestions needed.
          Pete Muir Master

          A managed hibernate session is just fine with Seam. The main thing to do is to write an implementation of the org.jboss.seam.persistence.PersistenceProvider component for your persistence provider. You may also want to write a extend the Seam transaction component to provide an implementation of your transaction.