2 Replies Latest reply on Apr 28, 2003 10:26 PM by nk74

    Clustering Entity Beans

    nk74 Newbie

      I'm using JBOSS 3.0.6
      Currently 2 servers with "all" options.
      I use ant and xdoclet to configure the options.
      After compiling (ant) the project I manually add true because i was unable to find the "clustering" option in xdoclet (version 1.1.2)

      My application uses stateless session beans which are clustered with no problems, and entity beans that are connected to the same DB (MySQL).

      My application produces an error while creating rows in the database:

      2003-04-27 17:20:14,772 ERROR [STDERR] javax.ejb.DuplicateKeyException: Entity with primary key [.1.] already exists
      2003-04-27 17:20:14,772 ERROR [STDERR] at org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.execute(JDBCCreateEntityCommand.java:128)
      2003-04-27 17:20:14,803 ERROR [STDERR] at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.createEntity(JDBCStoreManager.java:527)
      2003-04-27 17:20:14,803 ERROR [STDERR] at org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersistenceManager.java:253)
      2003-04-27 17:20:14,803 ERROR [STDERR] at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.createEntity(CachedConnectionInterceptor.java:270)
      2003-04-27 17:20:14,803 ERROR [STDERR] at org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:731)............

      I've purchased the manual and it recommends using row-locking which i enabled in jaws.xml. Also I left commit option B (as recommended). Any ideas on what I might be doing wrong?

      Cheers,

      Natasha

        • 1. Re: Clustering Entity Beans
          Darran Lofthouse Master

          Not the answer to your question but if you were to use XDoclet 1.2-beta2 here are the required tags to cluster an entity bean :-

          * @jboss.clustered
          * cluster="true"
          *
          * @jboss.persistence
          * row-locking="true"

          How do you assign the primary key values to your entity bean?

          Do you use some kind of sequence generator or do you look them up from somewhere?

          • 2. Re: Clustering Entity Beans
            nk74 Newbie

            The application that I'm using is one of the examples "transaction" posted on "documentation" part of this web site. I'm using xdoclet 1.1.2 and it doesn't have "@jboss.clustered" tag. I've tried installing the 1.2beta2 version but the "transaction" build.xml file throws errors because it was written for the older version.

            Can you please help me out?

            Thanks,
            Natasha