title: Oracle 12c Identity Column with EntityManager
body: <p>I have created sample table with identity column in oracle.</p>
  
  <pre><code>CREATE TABLE "CORE_PROD"."BOOK" 
     (    "ID" NUMBER GENERATED BY DEFAULT AS IDENTITY MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER  NOCYCLE  NOT NULL ENABLE, 
      "AUTHOR" VARCHAR2(255 BYTE), 
      "GENRE" VARCHAR2(255 BYTE), 
      "ISBN" VARCHAR2(255 BYTE), 
      "PUBLISHED" NUMBER NOT NULL ENABLE, 
      "TITLE" VARCHAR2(255 BYTE), 
       PRIMARY KEY ("ID")
    USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
    TABLESPACE "MCA_DATA"  ENABLE
     ) SEGMENT CREATION DEFERRED 
  
    PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
   NOCOMPRESS LOGGING
    TABLESPACE "PROD_DATA" ;
  </code></pre>
  
  <p>I have created the EntityManagerConfiguration using below configuration</p>
  
  <pre><code>@Bean
      public DataSource dataSource() {
          DriverManagerDataSource dataSource = new DriverManagerDataSource();
          dataSource.setDriverClassName(environment.getRequiredProperty("oracle.driver.class"));
          dataSource.setUrl(environment.getRequiredProperty("oracle.connection.url"));
          dataSource.setUsername(environment.getRequiredProperty("oracle.db.username"));
          dataSource.setPassword(environment.getRequiredProperty("oracle.db.password"));
          return dataSource;
      }
  
      @Bean
      public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
          LocalContainerEntityManagerFactoryBean bean = new LocalContainerEntityManagerFactoryBean();
          bean.setPackagesToScan(DomainPackage.class.getPackage().getName());
          bean.setDataSource(dataSource());
          bean.setJpaVendorAdapter(jpaVendorAdapter());
          bean.setJpaProperties(jpaProperties());
          return bean;
      }
  
      @Bean
      public JpaVendorAdapter jpaVendorAdapter() {
          HibernateJpaVendorAdapter jpaVendorAdapter = new HibernateJpaVendorAdapter();
          jpaVendorAdapter.setShowSql(true);
          jpaVendorAdapter.setGenerateDdl(true);
          return jpaVendorAdapter;
      }
  
      @Bean
      public PlatformTransactionManager transactionManager(EntityManagerFactory emf) {
          JpaTransactionManager jpaTransactionManager = new JpaTransactionManager();
          jpaTransactionManager.setEntityManagerFactory(emf);
          return jpaTransactionManager;
      }
  
      @Bean
      public PersistenceExceptionTranslationPostProcessor exceptionTranslation() {
          return new PersistenceExceptionTranslationPostProcessor();
      }
  
  
      private Properties jpaProperties() {
          Properties properties = new Properties();
          properties.put("hibernate.hbm2ddl.auto", environment.getRequiredProperty("hbm2ddl.auto"));
          properties.put("hibernate.dialect", environment.getRequiredProperty("hibernate.dialect"));
          properties.put("hibernate.show_sql", environment.getRequiredProperty("hibernate.show_sql"));
          properties.put("hibernate.format_sql", environment.getRequiredProperty("hibernate.format_sql"));
          // Configures the naming strategy that is used when Hibernate creates
          // new database objects and schema elements
          // properties.put("hibernate.ejb.naming_strategy",
          // environment.getRequiredProperty("hibernate.ejb.naming_strategy"));
          properties.put("hibernate.temp.use_jdbc_metadata_defaults",
                  environment.getRequiredProperty("use_jdbc_metadata_defaults"));
          return properties;
      }
  </code></pre>
  
  <p>Then I have created the BookRepository:</p>
  
  <pre><code>public interface BookRepository extends PagingAndSortingRepository&lt;Book, Long&gt; {
  }
  </code></pre>
  
  <p>Now when I am trying to persist the Book to my database I am facing issue.</p>
  
  <pre><code>Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in org.markit.oracle.datasource.config.EntityManagerConfiguration: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: No identifier specified for entity: org.markit.oracle.model.Book
  </code></pre>
  
  <p>I think I am facing the above issue because of the identity column(oracle 12c feature).</p>
  
  <p>Can someone suggest what I need to fix/add to run the code?</p>