Bonjour, voila une erreur qui me cause bien des soucis :
Code:
cause mère
org.hibernate.InvalidMappingException: Could not parse mapping document from resource test/Target.hbm.xml
org.hibernate.cfg.Configuration.addResource(Configuration.java:575)
org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1593)
org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1561)
org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1540)
org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1514)
org.hibernate.cfg.Configuration.configure(Configuration.java:1434)
org.apache.jsp.index_jsp._jspService(index_jsp.java:76)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
cause mère
org.hibernate.DuplicateMappingException: Duplicate class/entity mapping test.Target
org.hibernate.cfg.Mappings.addClass(Mappings.java:118)
org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:145)
org.hibernate.cfg.Configuration.add(Configuration.java:675)
org.hibernate.cfg.Configuration.addInputStream(Configuration.java:510)
org.hibernate.cfg.Configuration.addResource(Configuration.java:572)
org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1593)
org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1561)
org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1540)
org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1514)
org.hibernate.cfg.Configuration.configure(Configuration.java:1434)
org.apache.jsp.index_jsp._jspService(index_jsp.java:76)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
je ne comprend pas car j'ai vérifier le nom de mon fichier, son emplacement mais rien à faire, je vais vous montrer le reste de mon code...
hibernate.cfg.xmlCode:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.bytecode.use_reflection_optimizer">false</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql:///nod</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<mapping resource="test/Target.hbm.xml" />
<mapping resource="test/Node.hbm.xml" />
</session-factory>
</hibernate-configuration>
Target.hbm.xmlCode:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated 24 juin 2008 11:01:44 by Hibernate Tools 3.2.1.GA -->
<hibernate-mapping>
<class name="test.Target" table="target" catalog="nod">
<id name="idObject" type="string">
<column name="id_object" length="10" />
<generator class="assigned" />
</id>
<property name="idNode" type="string">
<column name="id_node" length="10" not-null="true" />
</property>
<property name="name" type="string">
<column name="name" length="30" not-null="true" />
</property>
</class>
</hibernate-mapping>
puis mon fichier de test
index.jspCode:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.util.*"%>
<%@page import="test.Node"%>
<%@page import="test.NodeHome"%>
<%@page import="test.Target"%>
<%@page import="test.TargetHome"%>
<%@page import="utils.HibernateUtil"%>
<%@page import="org.hibernate.*"%>
<%@page import="org.hibernate.cfg.*"%>
<%
SessionFactory factory;
Configuration cfg = new Configuration().addClass(test.Node.class).addClass(test.Target.class);
cfg.configure("hibernate.cfg.xml");
factory = cfg.buildSessionFactory();
Session s = factory.openSession();
Transaction tx = null;
tx = s.beginTransaction();
Target tar=new Target();
tar.setIdNode("un");
tar.setIdObject("un");
tar.setName("Targetone");
s.save(tar);
s.getTransaction().commit();
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test Upload</title>
</head>
<body>
Ceci est ma page de test
</body>
</html>
Voila voila, merci d'avance, en tout cas je ne comprend pas du tout d'ou cela peut venir tiens au passe je peux aussi vous donner un screemshot de mon classpath
si l'image ne s'affiche pas c normal :(