J'ai une entité qui modélise la structure parent/enfant, voici mon fichier de mapping hibernate :
<hibernate-mapping>
<class name="myPackage.entities.Module" table="MODULE">
<id name="idModule" type="int">
<column name="ID_MODULE" precision="6" scale="0" />
<generator class="sequence">
<param name="sequence">S_MODULE</param>
</generator>
</id>
<property generated="never" lazy="false" name="nomModule"
type="string">
<column length="30" name="NOM_MODULE" />
</property>
...
<!-----------------Childs------------------------->
<set fetch="select" inverse="true" lazy="false" name="subModules"
sort="unsorted" table="MODULE">
<key>
<column name="MOD_ID_MODULE" />
</key>
<one-to-many class="myPackage.entities.Module" />
</set>
<!-----------------parent------------------------->
<many-to-one class="myPackage.entities.Module" name="parentModule">
<column name="MOD_ID_MODULE" />
</many-to-one>
</class>
</hibernate-mapping>
voici les données :
"ID_MODULE" "ID_APPLICATION" "MOD_ID_MODULE"(parent) ...
"12" "2" "10"
"10" "2" "3"
"14" "2" "12"
"1" "1" ""
"2" "1" "1"
"3" "2" ""
"4" "2" "3"
"13" "2" "4"
"6" "1" "2"
Mon problème est que l'association many-to-one génère une exception lorsque j'essaie d'afficher l'objet dans la vue :
javax.servlet.ServletException: L'exécution de la servlet a lancé une exception
org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
cause mère
java.lang.StackOverflowError
java.lang.Exception.<init>(Exception.java:77)
java.lang.reflect.InvocationTargetException.<init>(InvocationTargetException.java:54)
sun.reflect.GeneratedMethodAccessor150.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:1773)
org.apache.commons.beanutils.PropertyUtilsBean.getSimpleProperty(PropertyUtilsBean.java:1132)
org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.java:686)
org.apache.commons.beanutils.PropertyUtilsBean.getProperty(PropertyUtilsBean.java:715)
org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:290)
org.ajax4jsf.javascript.ScriptUtils.writeScriptToStream(ScriptUtils.java:126)
org.ajax4jsf.javascript.ScriptUtils.writeScriptToStream(ScriptUtils.java:174)
org.ajax4jsf.javascript.ScriptUtils.writeScriptToStream(ScriptUtils.java:174)
org.ajax4jsf.javascript.ScriptUtils.writeScriptToStream(ScriptUtils.java:174)
org.ajax4jsf.javascript.ScriptUtils.writeScriptToStream(ScriptUtils.java:174)
org.ajax4jsf.javascript.ScriptUtils.writeScriptToStream(ScriptUtils.java:83)
org.ajax4jsf.javascript.ScriptUtils.writeScriptToStream(ScriptUtils.java:174)
org.ajax4jsf.javascript.ScriptUtils.writeScriptToStream(ScriptUtils.java:174)
org.ajax4jsf.javascript.ScriptUtils.writeScriptToStream(ScriptUtils.java:174)
org.ajax4jsf.javascript.ScriptUtils.writeScriptToStream(ScriptUtils.java:174)
org.ajax4jsf.javascript.ScriptUtils.writeScriptToStream(ScriptUtils.java:83)
org.ajax4jsf.javascript.ScriptUtils.writeScriptToStream(ScriptUtils.java:174)
org.ajax4jsf.javascript.ScriptUtils.writeScriptToStream(ScriptUtils.java:174)
org.ajax4jsf.javascript.ScriptUtils.writeScriptToStream(ScriptUtils.java:174)
org.ajax4jsf.javascript.ScriptUtils.writeScriptToStream(ScriptUtils.java:174)
org.ajax4jsf.javascript.ScriptUtils.writeScriptToStream(ScriptUtils.java:83)
...
Note : J'utilise Hibernate, Spring et JSF.
Merci pour votre aide