Thanks for the tip on that, very grateful.
Quick Xdoclet question that arises from there. I've set up the RightsConditionTypeValueRelationship as you suggested and in Rights and ConditionTypeValue but with my current settings for the method I'm getting the following error:
Code:
net.sf.hibernate.LazyInitializationException: Failed to lazily initialize a collection
This is the Xdoclet code that I have in the Rights class. What am I doing incorrectly?
Code:
/**
* @return Returns the rightsConditionTypeValues.
* @hibernate.bag
* name="rightsConditionTypeValues"
* cascade="save-update"
* lazy="true"
* @hibernate.collection-key
* column="fk_rights_id"
* @hibernate.collection-many-to-many
* column="fk_condition_type_value_id"
* class="au.edu.tlf.lips.model.RightsConditionTypeValueRelationship"
*/
public List getRightsConditionTypeValues() {
return rightsConditionTypeValues;
}
/**
* @param rightsConditionTypeValues The rightsConditionTypeValues to set.
*/
public void setRightsConditionTypeValues(List rightsConditionTypeValues) {
this.rightsConditionTypeValues = rightsConditionTypeValues;
}
SQL Code:
Code:
create table condition_type_value (
id BIGINT NOT NULL AUTO_INCREMENT,
has_text BIT,
is_defaulted_value BIT,
value VARCHAR(255),
fk_condition_type_value_id BIGINT,
primary key (id)
);
create table rights_condition_type_value_relationship (
id BIGINT NOT NULL AUTO_INCREMENT,
fk_condition_type_value_id BIGINT,
notes VARCHAR(255),
fk_rights_id BIGINT,
primary key (id)
);
create table rights (
id BIGINT NOT NULL AUTO_INCREMENT,
rights_id BIGINT,
fk_rights_type_id BIGINT,
fk_condition_type_id BIGINT,
primary key (id)
);
Stack trace:
Code:
net.sf.hibernate.LazyInitializationException: Failed to lazily initialize a collection
at net.sf.hibernate.collection.PersistentCollection.initialize(PersistentCollection.java:201)
at net.sf.hibernate.collection.PersistentCollection.read(PersistentCollection.java:71)
at net.sf.hibernate.collection.Bag.iterator(Bag.java:256)
at org.apache.taglibs.standard.tag.common.core.ForEachSupport.toForEachIterator(ForEachSupport.java:360)
at org.apache.taglibs.standard.tag.common.core.ForEachSupport.supportedTypeForEachIterator(ForEachSupport.java:238)
at org.apache.taglibs.standard.tag.common.core.ForEachSupport.prepare(ForEachSupport.java:172)
at javax.servlet.jsp.jstl.core.LoopTagSupport.doStartTag(LoopTagSupport.java:262)
at org.apache.taglibs.standard.tag.el.core.ForEachTag.doStartTag(ForEachTag.java:105)
at org.apache.jsp.WEB_002dINF.pages.licenceDetail_jsp._jspx_meth_c_forEach_8(licenceDetail_jsp.java:2167)
at org.apache.jsp.WEB_002dINF.pages.licenceDetail_jsp._jspx_meth_c_forEach_7(licenceDetail_jsp.java:2134)
at org.apache.jsp.WEB_002dINF.pages.licenceDetail_jsp._jspx_meth_c_if_6(licenceDetail_jsp.java:2086)
at org.apache.jsp.WEB_002dINF.pages.licenceDetail_jsp._jspx_meth_c_forEach_6(licenceDetail_jsp.java:2043)
at org.apache.jsp.WEB_002dINF.pages.licenceDetail_jsp._jspx_meth_c_if_5(licenceDetail_jsp.java:1944)
at org.apache.jsp.WEB_002dINF.pages.licenceDetail_jsp._jspx_meth_c_forEach_5(licenceDetail_jsp.java:1882)
at org.apache.jsp.WEB_002dINF.pages.licenceDetail_jsp._jspService(licenceDetail_jsp.java:296)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:750)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:636)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:546)
at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:1002)
at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:626)
at org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:142)
at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:178)
at org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:801)
at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:933)
at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:503)
at org.apache.jsp.layouts.baseLayout_jsp._jspx_meth_tiles_insert_5(baseLayout_jsp.java:1201)
at org.apache.jsp.layouts.baseLayout_jsp._jspService(baseLayout_jsp.java:319)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:750)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:510)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:445)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:359)
at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:88)
at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:238)
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:644)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:535)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:321)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:73)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:73)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:233)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at com.opensymphony.clickstream.ClickstreamFilter.doFilter(ClickstreamFilter.java:42)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:233)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at au.edu.tlf.lips.webapp.filter.ActionFilter.doFilter(ActionFilter.java:160)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:233)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at au.edu.tlf.lips.webapp.filter.BreadcrumbFilter.doFilter(BreadcrumbFilter.java:162)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:233)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at org.springframework.orm.hibernate.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:170)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:73)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:233)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:88)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:233)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at au.edu.tlf.lips.webapp.filter.GZIPFilter.doFilter(GZIPFilter.java:51)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:233)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:257)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:245)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:199)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:587)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:184)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:206)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:833)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:732)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:619)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:688)
at java.lang.Thread.run(Unknown Source)
Caused by: net.sf.hibernate.UnresolvableObjectException: No row with the given identifier exists: 2, of class: au.edu.tlf.lips.model.RightsConditionTypeValueRelationship
at net.sf.hibernate.UnresolvableObjectException.throwIfNull(UnresolvableObjectException.java:38)
at net.sf.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1943)
at net.sf.hibernate.type.ManyToOneType.resolveIdentifier(ManyToOneType.java:68)
at net.sf.hibernate.type.EntityType.resolveIdentifier(EntityType.java:232)
at net.sf.hibernate.type.EntityType.nullSafeGet(EntityType.java:154)
at net.sf.hibernate.collection.AbstractCollectionPersister.readElement(AbstractCollectionPersister.java:363)
at net.sf.hibernate.collection.Bag.readFrom(Bag.java:75)
at net.sf.hibernate.loader.Loader.readCollectionElement(Loader.java:305)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:219)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:915)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:890)
at net.sf.hibernate.loader.CollectionLoader.initialize(CollectionLoader.java:83)
at net.sf.hibernate.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:284)
at net.sf.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:3259)
at net.sf.hibernate.collection.PersistentCollection.initialize(PersistentCollection.java:195)
... 101 more