Announcement Announcement Module
Collapse
No announcement yet.
Spring vs EJB Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring vs EJB

    Hi all, I'm triyng to decide if made use of Spring remoting functionality instead of EJB in my distribuited architecture.
    I see two possible point of weakness:

    First.

    Using Spring I dont have a consolle on my A.S. where I can monitor transactions done by my EJBs.

    Second

    Loss of security in transactions.

    Am I wrong?
    Can you suggest me some advantages, instead, in using Spring remote functios, such to get rid of that two disadvantages? )


    Salud

    Max

  • #2
    Hi Max. You can still use CMT (container-managed transactions) with Spring. This should allow you to continue to use your AS monitor console. As far as security goes, we would need more details on what you are using/need, but you could probably use Acegi to fully replace it.

    Jess

    Comment


    • #3
      Originally posted by jbalint
      Hi Max. You can still use CMT (container-managed transactions) with Spring.
      Very intresting!!!
      But, would you be so kind to give me some docs about CMT implementation in Spring, where I can crash my head upon ?

      Thanks a lot!

      Salud

      Max

      Comment


      • #4
        Well check out chapter 8 (Transaction Management) of the reference manual. Spring uses it's own "PlatformTransactionManager" which has multiple internal implementations, eg. HibernateTransactionManager, DataSourceTransactionManager and the one you would be interested in, JtaTransactionManager.

        This means you can switch your transaction management strategy from JTA to Hibernate or DataSource with just the configuration. This is also very useful for running unit tests outside the app server where the JTA objects aren't available.

        Jess

        Comment


        • #5
          Another point I want to make: Spring and EJB are not separate. You should implement your business object agnostic from both Spring and EJB. And whether you make something an EJB, use another remoting strategy or call the object locally is a separate decision.

          At that point you can:
          - Wrap an EJB around your business object coded by hand (doing JNDI lookups, parameters, etc)
          - Store your business object in Spring and use one of the Spring base EJB classes to implement your EJB
          - Use Spring without EJB and use another remoting strategy

          Comment


          • #6
            Originally posted by jbalint
            Well check out chapter 8 (Transaction Management) of the reference manual. Spring uses it's own "PlatformTransactionManager" which has multiple internal implementations, eg. HibernateTransactionManager, DataSourceTransactionManager and the one you would be interested in, JtaTransactionManager.
            Well Jess, tell me if I have well understood.
            From the book, if I declare something like this

            Code:
            <bean id="petStoreTarget">
            ...
            </bean>
            <bean id="petStore"
            class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
            <property name="transactionManager"><ref bean="transactionManager"/></property>
            <property name="target"><ref bean="petStoreTarget"/></property>
            <property name="transactionAttributes">
            <props>
            <prop key="insert*">PROPAGATION_REQUIRED,-MyCheckedException</prop>
            <prop key="update*">PROPAGATION_REQUIRED</prop>
            <prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
            </props>
            </property>
            </bean>
            I have to use a JTATransactionManager for referenced bean "transactionManager", and then with this configuration I activate a transactional proxy listening on "insert" and "update" methods.
            But my question is: with this configuration I can monitor these transactions in my AS consolle ???

            Salud

            Max

            Comment


            • #7
              Originally posted by MaxVanL00N
              "transactionManager", and then with this configuration I activate a transactional proxy listening on "insert" and "update" methods.
              yes, the aspect (txProxy) will intercept those methods and apply transactioning.

              Originally posted by MaxVanL00N
              But my question is: with this configuration I can monitor these transactions in my AS consolle ???
              From the PoV of a common sence, if ur AS cosnole loggs all activity of a AS's own txManager, then it doesn't make any difference, where the manager is called from, right?

              I would recommend U simply to test this setup and see the console out.

              Comment


              • #8
                Originally posted by Injecteer
                I would recommend U simply to test this setup and see the console out.
                of course, for me first was born the test-case, then my code


                Salud

                Max

                Comment

                Working...
                X