Is the Oracle 12 'IDENTITY' type supported by Hibernate in JBoss EAP?

Solution Verified - Updated -

Issue

  • Oracle added support for the IDENTITY type in Oracle 12c (See the New Features Guide 2.1.6.3 IDENTITY Columns
  • The new Oracle type is meant to behave similarly to IDENTITY types in other databases (e.g. Microsoft SQL Server) which are already supported by Hibernate when appropriately configured
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    private Long id;
  • The following exception is raised if entities with IDENTITY type mappings (as above) are defined when attempting to create an entity factory using the Oracle dialect(s):
org.hibernate.MappingException: org.hibernate.dialect.Oracle10gDialect does not support identity key generation
    at org.hibernate.dialect.Dialect.getIdentityColumnString(Dialect.java:772)
    at org.hibernate.dialect.Dialect.getIdentityColumnString(Dialect.java:762)
    at org.hibernate.mapping.Table.sqlCreateString(Table.java:505)
    at org.hibernate.cfg.Configuration.generateSchemaCreationScript(Configuration.java:1038)
    at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:125)
    at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:501)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1794)
    at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:96)
    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:914)
    ...

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 4
    • 5
    • 6
  • Hibernate
    • 3
    • 4

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.