7 Replies Latest reply on Jan 22, 2009 11:25 PM by knice147

    SEAM without jpa and hibernate

    knice147

      I am a newbie to SEAM.  Is this possible, not to say this is how I plan to use seam, but is this possible?  Suppose I have an ActionBean with an action that saves user information and also returns a list of users to populate a datatable.  Lets also say I dont want to use the EntityManager but I want to use JDBC and CallableStatements instead to retrieve and save the data using stored procedures.  I would like to still use alot of the other features of SEAM, like the conversation state or the ability to pass parameters to actions.  Would this scenario be possible or does SEAM force me to use EJB3 or Hibernate.

        • 1. Re: SEAM without jpa and hibernate
          www.supernovasoftware.com

          You can still use native SQL with hibernate.  I do so frequently.


          What do you have against Hibernate or JPA?  They make my life much easier.

          • 2. Re: SEAM without jpa and hibernate
            knice147

            I make use of alot of stored procedures.  In a nutshell, I have a utility that wraps up the process of stored procedures and would rather use this instead of EntityManager.  So I would rather use this without jpa or hibernate.  Would this be possible?

            • 3. Re: SEAM without jpa and hibernate
              www.supernovasoftware.com

              Should be possible.  I would just get my application working with hibernate included.  Then try to strip it out if you really must.  You can load an object directly to a form and use Seam to inject it into a component and persist it trivially.  The reverse is just a trivial.  You can still make use of all your stored procedures and you will not be forced to use the entity manager or even map any entities if you don't want to.

              • 4. Re: SEAM without jpa and hibernate
                knice147

                is there anything special I need for the persistence.xml file?  Correct me if I am wrong, but it seems like it creates one instance of an EntityManager, and you reference that one by name in your action beans.  It seems almost like it somehow adds the EntityManager to the application scope.  Would I need to turn off this functionality to use say JDBC and CallableStatements instead of EntityManager or can I specify the object I frequently use in the persistance.xml file and have it use this instead of EntityManager.

                • 5. Re: SEAM without jpa and hibernate
                  malex
                  In one of our projects we completey avoid using of Seam/EJB3 persistance mechanisms (the app runs with a framework having its own), but benefit from all the great rest of the Seam functionality, like component handling/wireing, Email, PDF rendering, and so on (I know, we use miss one of strongest points of Seam ;)).

                  However, in that case we have to switch off transaction handling in Seam:

                  components.xml:

                  <core:init debug="true" transaction-management-enabled="false"/>
                  <transaction:no-transaction/>
                  • 6. Re: SEAM without jpa and hibernate
                    knice147

                    I cant thank you enough for that piece of information.  Ive been pulling my hair out on this.  Is there anything else I need to configure?  Also, are you just replacing the EntityManager on any given Action Bean with you persistence mechanism?  Are you letting SEAM allocate the persistence manager using the @IN annotation or are you actually allocating it as you need it?



                    Marcus Spiegel wrote on Jan 22, 2009 10:06:


                    In one of our projects we completey avoid using of Seam/EJB3 persistance mechanisms (the app runs with a framework having its own), but benefit from all the great rest of the Seam functionality, like component handling/wireing, Email, PDF rendering, and so on (I know, we use miss one of strongest points of Seam ;)).


                    However, in that case we have to switch off transaction handling in Seam:




                    • 7. Re: SEAM without jpa and hibernate
                      knice147

                      Also can you refer me to any online docs and examples you might have used to achieve this functionality?