5 Replies Latest reply on Apr 18, 2012 11:05 PM by marius.bogoevici

    Clustering + Spring + Hibernate without EJBs -- possible?

    duncow9000

      Is it possible to use clustering with JBoss AS and JBoss Cache with Hibernate and Spring, but without using EJBs (i.e. without using the EntityManager)? We have heard doubts about JBoss' ability to do this -- that we would be forced to use EJBs and/or JBoss' Hibernate service to take advantage of JBoss Cache's clustering capabilities. But I don't see why this should be.

      We are deploying everything, including Hibernate, in a single WAR file. Thus we want to run our application on JBoss almost as if we were running it on pure Tomcat, using JBoss only for JBoss Cache and the JTA transaction manager it requires. We don't want to incur the considerable expense of migrating to EJB 3 (at least not right now).

      Our Java application uses Hibernate POJOs and Spring's declarative transaction management, similar to what Rod Johnson outlined in "J2EE Development without EJBs" back in 2004. We have been running this on Tomcat 6. We now want to run this app in a clustered environment, and we have been exploring options on Tomcat (e.g. Terracotta) but have run into problems and are keeping our options open. Enter JBoss.

      If we were to use Spring's JtaTransactionManager as the transactionManager for the AnnotationTransactionAttributeSource transactionInterceptor, would the JtaTransactionManager automatically delegate to JBoss's JTA provider? Presumably JBoss Cache would use JTA by default. Can we continue to use the Hibernate we have packaged in our WAR, or will we be forced to use JBoss' Hibernate service? And if so, is that even an option with our EJB-free architecture?

      Of course we can just fire it up and see what happens, and likely we will, but even if it seems to be working, it would be good to have some confirmation from the community that others have had success with this configuration. If we're doing something fundamentally wrong I'd like to know up front, rather than find out through some subtle yet horrible error in production.

      Thanx

      Kevin