全て。次のコードがありました。
@ManyToMany(targetEntity = com.acs.gs.juror.model.security.SecurityGroup.class, cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinTable(name = "REP_DSGN_SEC_GRP_LNK",
joinColumns = {@JoinColumn(name = "REPORT_DESIGN_UUID", referencedColumnName = "UUID")},
inverseJoinColumns = {@JoinColumn(name = "SECURITY_GROUP_UUID", referencedColumnName = "UUID")})
@IndexColumn(name="HIBERNATE_IDX")
private List<SecurityGroup> groups;
ある日、複数のバッグの問題が発生し始めました。したがって、セットに変更して修正しました。
@ManyToMany(targetEntity = com.acs.gs.juror.model.security.SecurityGroup.class, cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinTable(name = "REP_DSGN_SEC_GRP_LNK",
joinColumns = {@JoinColumn(name = "REPORT_DESIGN_UUID", referencedColumnName = "UUID")},
inverseJoinColumns = {@JoinColumn(name = "SECURITY_GROUP_UUID", referencedColumnName = "UUID")})
@IndexColumn(name="HIBERNATE_IDX")
private Set<SecurityGroup> groups;
データローダーを実行して次のエラーが発生するまで、これは正常に機能します。
[java] Exception in thread "main" com.acs.gs.juror.dao.FailedInsertException: Unable to save object:ALTF Funds By Case|ALTF Funds By Case Report|java.util.GregorianCalendar[time=18000000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="America/New_York",offset=-18000000,dstSavings=3600000,useDaylight=true,transitions=235,lastRule=java.util.SimpleTimeZone[id=America/New_York,offset=-18000000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=1970,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=5,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=-18000000,DST_OFFSET=0]|null|ALTFFundsByCase||PDF|[]|Lexptrain|Lexptrain|314||REPORTING|OUTPUT_TYPE|Browser|Browser|Jan 1, 1970 12:00:00 AM||null|null|null|null|null|null|null|null|null|null|null|
[java] at com.acs.gs.juror.dao.hibernate.HibernateDAO.create(HibernateDAO.java:65)
[java] at com.acs.gs.juror.dataload.cs.maricopa.LoadReportDesigns.loadData(LoadReportDesigns.java:116)
[java] at com.acs.gs.juror.dataload.cs.maricopa.SeedDataLoader.loadData(SeedDataLoader.java:48)
[java] at com.acs.gs.juror.dataload.cs.maricopa.SeedDataLoader.main(SeedDataLoader.java:18)
[java] Caused by: org.springframework.dao.DataIntegrityViolationException: Could not execute JDBC batch update; nested exception is org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
[java] at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:636)
[java] at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
[java] at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:424)
[java] at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
[java] at org.springframework.orm.hibernate3.HibernateTemplate.save(HibernateTemplate.java:694)
[java] at com.acs.gs.juror.dao.hibernate.HibernateDAO.create(HibernateDAO.java:62)
[java] ... 3 more
[java] Caused by: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
[java] at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:94)
[java] at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
[java] at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)
[java] at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266)
[java] at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:171)
[java] at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
[java] at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
[java] at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1027)
[java] at org.springframework.orm.hibernate3.HibernateAccessor.flushIfNecessary(HibernateAccessor.java:390)
[java] at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:420)
[java] ... 6 more
[java] Caused by: java.sql.BatchUpdateException: Cannot insert the value NULL into column 'HIBERNATE_IDX', table 'agilejury-thehl_MC.dbo.REP_DSGN_SEC_GRP_LNK'; column does not allow nulls. INSERT fails.
[java] at net.sourceforge.jtds.jdbc.JtdsStatement.executeBatch(JtdsStatement.java:947)
[java] at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:1723)
[java] at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
[java] at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
[java] ... 13 more
@IndexColumn エントリを無駄に削除しようとしました。Hibernate は関係なく列を作成します。マッピングせずに休止状態が作成された場合、値を格納する方法がないため、null であるという問題が発生する可能性はありますか?
私はこの時点で立ち往生しており、どうすればよいかわかりません。
ありがとう。