2
我收到一個如下所示的錯誤。這與我的瀑布建立方式有關嗎?哪裏是適合開始調查的地方?現在我有一個角色有許多角色職責。角色責任屬於角色。 RoleDuty只有一個字段,值班,這是一個空字符串。角色具有RoleDuties列表的all-delete-orphan映射。hibernate聲明從grails項目中失敗
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>()
}
請出示你的角色和RoleDuty類定義 – 2010-12-06 15:16:57