18 Ekim 2009 Pazar

Could not execute JDBC batch update

the error Could not execute JDBC batch update comes out when the entities are as follows and you are trying to save the parent entity:

parent entity
  @OneToMany(cascade = CascadeType.ALL)
   @JoinTable(name = "TBL_INCIDENT_ABSEVIDGRP", joinColumns = {
        @JoinColumn(name = "FLD_INCIDENT_ID")
    },
    inverseJoinColumns = {
        @JoinColumn(name = "FLD_ABSEVIDGRP_ID")
    })
private List childList = new ArrayList();

child entity
    @ManyToOne
    @JoinTable(name = "TBL_INCIDENT_ABSEVIDGRP", joinColumns = {
        @JoinColumn(name = "FLD_ABSEVIDGRP_ID")
    },
    inverseJoinColumns = {
        @JoinColumn(name = "FLD_INCIDENT_ID")
    })
private Parent parent;

the error is solved by commenting out the green and bold code portion..
the lack of red code portion leads to the following error while saving the parent entity:
Error while commiting the transaction
javax.persistence.RollbackException: Error while commiting the transaction
        at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:71)
...
Caused by: org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: Child Entity
 

Hiç yorum yok:

Yorum Gönder