Я получаю ошибку, которая начинается следующим образом. Это как-то связано с настройкой моих каскадов? Где правильное место, чтобы начать расследование? Прямо сейчас у меня есть роль, которая имеет много RoleDuty. RoleDuty принадлежит роли. RoleDuty имеет только одно поле, duty, которое может быть строкой Nullable. Роль имеет сопоставление all-delete-orphan для списка RoleDuties.
06.12.2010 10:02:17 *ERROR* AssertionFailure: an assertion failure occured (this may indicate a bug in Hibernate, but is
more likely due to unsafe use of the session) (AssertionFailure.java, line 47)
org.hibernate.AssertionFailure: null id in RoleDuty entry (don't flush the Session after an exception occurs)
at org.hibernate.event.def.DefaultFlushEntityEventListener.checkId(DefaultFlushEntityEventListener.java:78)
at org.hibernate.event.def.DefaultFlushEntityEventListener.getValues(DefaultFlushEntityEventListener.java:187)
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:14
3)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:219)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListen
er.java:99)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:49)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1027)
at org.springframework.orm.hibernate3.HibernateAccessor.flushIfNecessary(HibernateAccessor.java:390)
at org.codehaus.groovy.grails.orm.hibernate.support.GrailsOpenSessionInViewInterceptor.flushIfNecessary(GrailsOp
enSessionInViewInterceptor.java:116)
at org.springframework.orm.hibernate3.support.OpenSessionInViewInterceptor.postHandle(OpenSessionInViewIntercept
or.java:181)
at org.codehaus.groovy.grails.orm.hibernate.support.GrailsOpenSessionInViewInterceptor.postHandle(GrailsOpenSess
ionInViewInterceptor.java:66)
at org.springframework.web.servlet.handler.WebRequestHandlerInterceptorAdapter.postHandle(WebRequestHandlerInter
ceptorAdapter.java:61)
at org.codehaus.groovy.grails.web.servlet.GrailsDispatcherServlet.doDispatch(GrailsDispatcherServlet.java:303)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
Определения классов:
class RoleDuty
{
static belongsTo = [role:Role]
static constraints = {
duty(nullable: true)
}
static mapping = {
duty type:"text"
}
String duty;
boolean _deleted
static transients = ['_deleted']
@XmlValue
public String getDuty(){
return duty;
}
String toString()
{
return duty;
}
}
public class Role implements Comparable
{
static belongsTo = [project:Project]
static hasMany = [ roleDuties:RoleDuty]
static mapping = {
roleDuties cascade:"all-delete-orphan", lazy:false
}
List<RoleDuty> roleDuties = new ArrayList<RoleDuty>()
}