Bonjour,

J'utilise Hibernate Annotation 3.0 et je voudrais spécifier de faire une outer-join lors d'une recherche. Puisque visiblement ce n'est pas possible avec les annotations, je vais utiliser en plus, un fichier de mapping xml.

Voici son contenu :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"hibernate-mapping-3.0.dtd">
<hibernate-mapping package="domain">
	<class name="Client" table="client">
		<id name="id"/>
		<list 
			name="comptes"
			table="compte"
			outer-join="true"
		>
			<key column="id_client"/>
			<index column="id"/>
			<one-to-many class="domain.Compte"/>
		</list>
	</class>
 
	<class name="Compte" table="compte">
		<id name="id"/>
		<many-to-one name="client" class="domain.Client" column="id_client"/>
	</class>
 
</hibernate-mapping>
J'ajoute le fichier ainsi dans la configuration :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
config.addFile("Client.hbm.xml");
Mais voilà, quelque soit l'endroit où je place mon fichier .xml et mon fichier .dtd, j'obtients l'erreur suivante :

org.hibernate.MappingException: Could not read mapping document from file: Client.hbm.xml
at org.hibernate.cfg.Configuration.addFile(Configuration.java:279)
at util.HibernateUtil.<clinit>(HibernateUtil.java:92)
at dao.hibernate.HibernateDaoFactory.getClientDao(HibernateDaoFactory.java:109)
at service.referentiel.impl.ClientServiceImpl.count(ClientServiceImpl.java:63)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:287)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:124)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:112)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
at weblogic.ejb.container.injection.EnvironmentInterceptor.invoke(EnvironmentInterceptor.java:32)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:95)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:124)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:112)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
at $Proxy79.count(Unknown Source)
at service.referentiel.impl.ClientServiceImpl_3mmudc_ClientServiceImpl.count(ClientServiceImpl_3mmudc_ClientServiceImpl.java:266)
at service.referentiel.impl.ClientServiceImpl_3mmudc_ClientServiceWrap.count(ClientServiceImpl_3mmudc_ClientServiceWrap.java:66)
at managedBean.referentiel.client.RechercheClientBean.countClients(RechercheClientBean.java:249)
at managedBean.referentiel.client.RechercheClientBean.rechercher(RechercheClientBean.java:152)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:129)
at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
at javax.faces.component.UICommand.broadcast(UICommand.java:106)
at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:94)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:168)
at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:343)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:225)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:127)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:267)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3205)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:1986)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1893)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1377)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
Caused by: org.dom4j.DocumentException: Client.hbm.xml (Le fichier spécifié est introuvable) Nested exception: Client.hbm.xml (Le fichier spécifié est introuvable)
at org.dom4j.io.SAXReader.read(SAXReader.java:266)
at org.hibernate.cfg.Configuration.addFile(Configuration.java:270)
... 53 more


Où dois-je placer les fichiers .xml et .dtd ?
Le deux types de mapping (annotations et fichier) peuvent-ils être utilisés simultanément ?

Merci d'avance