I have created a dummy entity like the one below.
@Entity @GenericGenerator(name = "CA_SEQUENCE_GENERATOR",strategy = "com.mycompany.MySequenceGenerator", parameters = {@Parameter(name = "sequence_name", value = "CA_SEQ"), @Parameter(name = "increment_size", value = "50") } ) public class DummyEntity { private BigDecimal id; /** default constructor */ public DummyEntity() { } // Property accessors @Id @GeneratedValue(strategy=GenerationType.SEQUENCE,generator="CA_SEQUENCE_GENERATOR") public BigDecimal getId() { return this.id; } public void setId(BigDecimal Id) { this.id = Id; } }
Here, the whole purpose is that I need to get hold of the Id generated by Hibernate. I dont want to make a call to the DB to get the next sequence value.
public BigDecimal getIdentity(MyObject instance){ entityManager.persist(instance); entityManager.flush(); return instance.getId();
}
This throws an exception java.sql.BatchUpdateException: ORA-00942: table or view does not exist
|