I'm using JPA to implement my entity framework backed by Hibernate as an ORM to work with Oracle DB.
Everything is glued up (Autowired) with Spring.
To generate the DB schema I've added this to the jpa-context.xml
<bean id="h8JPAVendorAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="showSql" value="false" />
<property name="generateDdl" value="true" />
</bean>
I've used sequence-generator to generate IDs for entities but for some reason when the schema is beeing created\updated, Hibernate doesn't create the Sequences them selves.
This is my mapping.xml file which injects the identity field
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
version="1.0">
<mapped-superclass class="com.myapp.entity.BaseModelEntity" access="FIELD">
<attributes>
<id name="id">
<generated-value strategy="SEQUENCE" generator="MODEL_SEQ"/>
<sequence-generator name="MODEL_SEQ" sequence-name="MYAPP_MODEL_SEQ"/>
</id>
</attributes>
</mapped-superclass>
</entity-mappings>
Searching Google always give me results of how to use existing sequences, however I would like Hibernate to create them form me.
Thanks in advance for your help