2 Replies Latest reply on Nov 21, 2001 3:53 PM by plightbo

    primary key generation

    plightbo

      Any tips on how primary keys are generated for CMP entity beans? I usually use OpenSymphony's Sequence generator, but it doesn't work with JBoss (at least out of the box). Is there a way to make JAWS use a sequence inside Oracle? I think this would be a great feature. If this isn't possible, are there any sequence generators that work out of the box with jboss?

        • 1. Re: primary key generation
          schaefera

          Not as far as I know. This is an old problem and there are various solutions.

          Can you tell me why the OpenSymphony's Sequence generator is not working ?

          Andy

          • 2. Re: primary key generation
            plightbo

            I've decided I'm going to go ahead and just use a GUID generator. Statistically, the odds of repeating an ID are [entitites]/36^30, using the GUID class included in OSCore (same module that OSSequence comes with).

            OSSequence doesn't work perfectly with JBoss. There are a few issues I encountered: classpaths.. OSSequence and OSPropertySet have issues deploying if oscore.jar isn't in the jboss/lib directory, even though their MANIFEST files include "lib/oscore.jar" which is included in the .ear file. This doesn't happen with orion.

            Also, verifier complains about all sorts of stuff with OSSequence and OSPropertySet. They might work, but I'd rather they deployed a little smoother. I've got CVS access for OpenSymphony, so I might just patch it up and commit the changes.

            However, I've been using OSSequence for a while with orion, and I sometimes face problems where an ID already generated is returned, resulting in an EntityAlreadyExsistsException. Until app servers can tie their CMP implementation to the db vendor's sequence generators, I think I'll use GUIDs for now.

            -Pat