2 Replies Latest reply on Jul 16, 2009 10:30 AM by tanner tse

    JPA Oracle Dialect does not support identity key generation??

    tanner tse Newbie
      Anybody please provide some help.

      I have a table in Oracle database, like this:

        CREATE TABLE "CONTENT_WK"
        (
          "ID" varchar2(32) DEFAULT rawtohex(sys_guid()) NOT NULL ENABLE,
          "CONTENT" VARCHAR2(255 BYTE) NOT NULL ENABLE
        )

      And here is my entity class:

      /**
      * ContentWk generated by hbm2java
      */
      @Entity
      @Table(name = "CONTENT_WK")
      public class ContentWk implements java.io.Serializable {

          @Id
          @GeneratedValue(strategy = GenerationType.IDENTITY)
          @Column(name = "ID", unique = true, nullable = true, length = 32)
          @Length(max = 32)
          public String getId() {
              return this.id;
          }

          public void setId(String id) {
              this.id = id;
          }


          @Column(name = "CONTENT", nullable = false, columnDefinition = "nvarchar2", length = 512)
          @NotNull
          public String getContent() {
              return this.content;
          }

          public void setContent(String content) {
              this.content = content;
          }
         
          // constructor
          // .....
         
      }


      JPA throw some exception like this:
      Caused by: java.lang.IllegalArgumentException: Dialect does not support identity key generation
              at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:216)
              at org.jboss.seam.persistence.EntityManagerProxy.persist(EntityManagerProxy.java:137)
              at org.jboss.seam.framework.EntityHome.persist(EntityHome.java:84)