मैं जेपीए बैच अद्यतन हाइबरनेट प्रदर्शन कर रहा है और इसके लिए मुझे निम्न त्रुटिPostgres त्रुटि: "hibernate_sequence" संबंध मौजूद नहीं है स्थिति 17
2015-04-21 15:53:51,907 WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (Thread-283 (HornetQ-client-global-threads-462057890)) SQL Error: 0, SQLState: 42P01
2015-04-21 15:53:51,908 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (Thread-283 (HornetQ-client-global-threads-462057890)) ERROR: relation "my_seq_gen" does not exist
दे रहा postgres डेटाबेस का उपयोग कर रहा हूँ और मेरा पहचान पत्र ऑटो
उत्पन्न होता है@Id
@SequenceGenerator(name="seq-gen",sequenceName="MY_SEQ_GEN"initialValue=205, allocationSize=12)
@GeneratedValue(strategy= GenerationType.SEQUENCE, generator="seq-gen")
@Column(name="\"ID\"",unique=true,nullable=false)
private int id;
यह मेरा बैच डालने कोड स्निपेट
getEm().getTransaction().begin();
System.out.println("transaction started--------------");
try {
for (Receipt ReceiptEntity : arrReceiptEntity) {
getEm().persist(ReceiptEntity);
}
getEm().getTransaction().commit();
System.out.println("commited");
} catch (Exception exception) {
System.out.println("error----------------------------------------------------------------------");
if(getEm().getTransaction().isActive())
getEm().getTransaction().rollback();
LOG.error(exception);
} finally {
getEm().flush();
getEm().clear();
getEm().close();
}
मैं के लिए शामिल किया है है persistence.xml
<property name="hibernate.id.new_generator_mappings" value="true"/>
कृपया बताएं कि मैं क्या गलत कर रहा हूं।
कोशिश GenerationType.IDENTITY – Pratik
http://stackoverflow.com/a/25279598/592355 – xerx593