I have an issue with AUTO INCREMENT field in Oracle 12c. It can not insert data into tables which have IDENTITY define. It throws exception when Hibernate persist. If anyone have experience on it. Please share!
Note: I also try with other solution like create SEQUENCE and TRIGGER as link below. However, it throws the same errors. :(
http://stackoverflow.com/questions/2384420/how-is-my-id-being-generated-with-jpa-using-hibernate-with-the-oracle-10g-dialecException: java.lang.IllegalArgumentException: org.hibernate.dialect.
Oracle10gDialect does not support identity key generation
+ persistence.xml
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" />
+ Oracle Table
CREATE TABLE "USER"
( "USER_ID" NUMBER(10,0)
GENERATED BY DEFAULT ON NULL AS IDENTITY, "APP_USER_ID" NUMBER(10,0),
..............
)
+ Hibernate
@Entity
@Table(name="USER")
public class User implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name="USER_ID")
private Integer UsrId;
+ Java code
entityManager.persist(user); -----> Exception: java.lang.IllegalArgumentException: org.hibernate.dialect.
Oracle10gDialect does not support identity key generation
Thank you very much.