I'm using jpa+hibernate3.5.3+spring. DB Oracle.
My Dto:
Code:
@Entity
@Table(name="RES")
public class Reserve implements Serializable {
private static final long serialVersionUID = 1L;
@GeneratedValue(generator="my_seq")
@SequenceGenerator(name="my_seq",sequenceName="SEQ_RES", allocationSize=1)
@Id
private long idreserva;
@Temporal(TemporalType.DATE)
private Date datacreacio;
......
When start app in tomcat catalina.out shows next message
Code:
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: punit] Unable to build EntityManagerFactory
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:742)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:158)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:224)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:291)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
... 45 more
Caused by: org.hibernate.MappingException: Could not instantiate id generator [entity-name=com.xc.Res]
at org.hibernate.id.factory.DefaultIdentifierGeneratorFactory.createIdentifierGenerator(DefaultIdentifierGeneratorFactory.java:117)
at org.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:178)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:257)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1385)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:858)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:733)
... 50 more
Caused by: java.lang.NullPointerException
at org.hibernate.id.SequenceGenerator.configure(SequenceGenerator.java:81)
at org.hibernate.id.SequenceHiLoGenerator.configure(SequenceHiLoGenerator.java:60)
at org.hibernate.id.factory.DefaultIdentifierGeneratorFactory.createIdentifierGenerator(DefaultIdentifierGeneratorFactory.java:110)
... 55 more
If I comment
@GeneratedValue(generator="my_seq")
@SequenceGenerator(name="my_seq",sequenceName="SEQ_RES", allocationSize=1)
All work fine but i can't insert for integrity.
I need insert using Oracle sequence, Can sombody help me?
Sorry for my bad English.