は、私がここで私のモデルであるelcipselinkのEclipseLink manytooneは
とpersitの問題を持って保存していません。
その後、私が行うときに:私は書き込みのために、バッチ挿入を使用して、mは
@Override
public void save(T entityToSave) {
this.getEntityManager().persist(entityToSave);
}
ある
this.serviceStopPoint.save(currentStopPoint);
for (AssocLangueCodeBeGare assoc : listAssocLangueCodeBeGare) {
assoc.setStopPoint(currentStopPoint);
this.serviceAssocLangueCodeBeGare.save(assoc);
}
保存時々私は別のエンティティのフラッシュが行われ、私が手に保存するとき:
Caused by: org.h2.jdbc.JdbcBatchUpdateException: NULL not allowed for column "ID_GARE"; SQL statement:
INSERT INTO TBL_ASSOC_LANGUE_CODE_BE_GARE (CODE_BE, ID_GARE, ID_LANGUE) VALUES (?, ?, ?) [23502-192]
at org.h2.jdbc.JdbcPreparedStatement.executeBatch(JdbcPreparedStatement.java:1208)
at org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.executeBatch(DatabasePlatform.java:2134)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeJDK12BatchStatement(DatabaseAccessor.java:871)
マッピングで何か不足していますか?
iはstoppointエンティティにこのような何かを追加する必要がない:EDIT1
@
@OneToMany(mappedBy = "stopPoint", cascade = CascadeType.ALL)
List<AssocLangueCodeBeGare> assocLangueCodeBeGares;
私はそれがNULLであったため、その私のEmbeddedIdによって引き起こされると思います!!マッピングは埋め込み可能なオブジェクトに正しい値を設定しませんか?ここ
はembedableオブジェクトです:
@Embeddable
public class AssocLangueCodeBeGareFK implements Serializable {
private String id_langue;
private Long id_gare;
@Override
public int hashCode() {
おかげでたくさん!
insertable = falseおよびupdatable = falseは、マッピングの値がデータベースに書き込まれないようにします。うまくいけば、そのデータベース列に別のマッピングがあり、値を設定しているか、設定されていないことを願っています。 – Chris