6 Replies Latest reply on Apr 24, 2002 12:14 PM by pajama

    cmp + oracle sequence

    rbottoms

      Got a problem using Container Managed Persistence. All the examples I've been working from assume that the primary key is known at runtime.

      However, I am using a database table that creates the primary key dynamically using triggers & a sequence.

      Anyone have some example ejb-jar.xml, jaws.xml & jboss.xml files that address a similar problem?

        • 1. Re: cmp + oracle sequence
          jmschust

          What's the issue? If you create the primary key via a trigger, that just makes your descriptors easier since you don't put in the autocreation stuff.

          Other than that, you just have to specifiy which field is the primary key, and it's type.

          • 2. Re: cmp + oracle sequence
            jmschust

            Oh, and if the issue is how do you INSERT, just make sure you use a 'null' as the primary field value.

            • 3. Re: cmp + oracle sequence
              dsundstrom

              This won't until Oracle releases a JDBC 3.0 driver, and you upgrade to JDK 1.4, which is required for JDBC 3.0.

              In a future release, 3.0 final or 3.1, I will add support for "unknown primary key" (see spec), and you will be able to hook this up to a sequence. This is not exactally what you are doing because the value would be filled in by the app server and not the db (from a trigger).

              • 4. Re: cmp + oracle sequence
                pajama

                Will that require a JDBC 3 driver?
                MySQL doesn't have one yet.

                Or will it be a wrapper around JDBC 1/2 drivers?

                Ricardo

                • 5. Re: cmp + oracle sequence
                  dsundstrom

                  The stuff I'm going to write will support 1/2 drivers.

                  • 6. Re: cmp + oracle sequence
                    pajama

                    In the meantime it will be a good idea to deploy the varia/autonumber EJBs in the default installation of JBoss 3.0.0

                    The varia build doesn't include a xml deployment descriptor for autonumber, just the entity beans. No session bean either.

                    I think is a good idea to provide that kind of service in the default installation... until JBoss supports a generic and database independant way to use sequence/autonumber/identity columns.

                    Thanks.

                    Ricardo