2 Replies Latest reply on Aug 17, 2004 6:01 AM by Gregory Chazalon

    How to avoid the select before insert with JDBCPkSqlCreateCo

    Gregory Chazalon Newbie

      Hi,

      I have been seaching for similar cases in the forums, but found nothing similar. So please consider the following :

      I use the JDBCPkSqlCreateCommand entity command for generating the primary keys for one of my CMP entity beans. In fact, the SQL involved here uses an oracle sequence and some others oracle functions to generate a unique key.
      Since I can guarantee that the generated PKs will always be unique, I'd like to spare the statement "SELECT COUNT(*) FROM table WHERE table.pk = my_new_generated_pk" before the "INSERT" statement. Moreover, the table the bean is mapped on will have many rows (several millions actually) , so I definitely need to avoid this costly and unnecessary check.

      So here is my question : How can I do this ?
      Is there a magic attribute to specify to the JDBCPkSqlCreateCommand entity command or do I have to create my own command class to achieve this ?

      By the way, I'm using JBoss 3.2.3.

      Thanks for your advice


      Gregory