0 Replies Latest reply on Apr 30, 2009 2:44 PM by richkatz

    JPA Peristence exception Hibernate, Derby: could not get nex

    richkatz

      Does any one know what causes this?

      What do I do to get around it either using annotations or using XML?


      The exact problem is that when JPA invokes TableGenerator it execute the following SQL command on Derby:
      select next_hi from hibernate_unique_key for read only with rs


      It encouters the following error:

      javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not get or update next value

      Caused by: java.sql.SQLException: Table/View 'HIBERNATE_UNIQUE_KEY' does not exist.

      Derby does not have sequence tables.

      We are using:

      @Id
      @Column(name="UserID")
      @GeneratedValue(strategy=GenerationType.AUTO)

      The identity column in Derby is defined in the create table command as:

      UserID INT NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,

      Many thanks.

      Regards,

      Rich Katz