0 Replies Latest reply on Jul 28, 2005 7:17 AM by Sameer Saptarishi

    Unique key constraint in a CMP using JBoss 4.0.2 and MySQL 4

    Sameer Saptarishi Newbie

      Hi All,

      I am using an entity bean to create my table in MySQL4.1.13
      I have a table called user which has userid,username,password as its columns.
      The userid is a primary key over here.
      But I want the user name to be unique.
      I.e if a user with the name 'Adrian' is present in the database then another user with this user name should not be created.

      I have been told that you can configure a unique key in jbosscmp-jdbc.xml using insert-after-ejb-post-create.

      But i dont know how to use it.
      Can anyone give me a sample code for using this.

      Any help would be appreciated.