I have created an .hbm.xml file :
<xml version="1.0"?>
<hibernate-mapping package="com.cmp.iard.sinistre.hbm.dossier">
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd >
<class
name="Personne"
table="NOYS_PERSONNE"
>
<meta attribute="sync-DAO">false</meta>
<id
name="id"
type="string"
column="CODE_PERS"
>
<generator class="assigned" />
</id>
<!--
<property
name="codePers"
column="CODE_PERS"
type="string"
not-null="true"
length="25"
/>
-->
<many-to-one
name="codeObjParamSinistre"
column="CODE_OBJ_PARAM_SINISTRE"
class="com.afrikbrain.iard.sinistre.hbm.ref.Paramsinistre"
not-null="false"
>
</many-to-one>
<!--
<property
name="codeObjParamSinistre"
column="CODE_OBJ_PARAM_SINISTRE"
type="string"
not-null="true"
length="25"
/>
-->
<many-to-one
name="codeMissionExpert"
column="CODE_MISSION_EXPERT"
class="MissionExpert"
not-null="false"
>
</many-to-one>
<!--
<property
name="codeMissionExpert"
column="CODE_MISSION_EXPERT"
type="string"
not-null="true"
length="25"
/>
-->
<many-to-one
name="codeProfession"
column="CODE_PROF"
class="com.cmp.iard.srv.ref.Profession"
not-null="false"
>
</many-to-one>
<many-to-one
name="codeSousDossier"
column="CODE_SOUS_DOSSIER"
class="SousDossier"
not-null="false"
>
</many-to-one>
<property
name="nom"
column="NOM_PERS"
type="string"
not-null="false"
length="100"
/>
<property
name="localisation"
column="LOCALISATION_PERS"
type="string"
not-null="false"
length="100"
/>
<property
name="telephone"
column="TELEPHONE_PERS"
type="string"
not-null="false"
length="100"
/>
<property
name="adresse"
column="ADRESSE_PERS"
type="string"
not-null="false"
length="100"
/>
<!--
<property
name="type"
column="TYPE_PERS"
type="string"
not-null="false"
length="5"
/>
-->
<property
name="titre"
column="TITRE_PERS"
type="string"
not-null="false"
length="25"
/>
<property
name="dateNaissance"
column="DATE_NAISS_PERS"
type="date"
not-null="false"
length="7"
/>
<property
name="lieuNaissance"
column="LIEU_NAISS_PERS"
type="string"
not-null="false"
length="50"
/>
<property
name="numeroPermis"
column="NUM_PERMIS_PERS"
type="string"
not-null="false"
length="50"
/>
<property
name="categoriePermis"
column="CATEG_PERMIS_PERS"
type="string"
not-null="false"
length="50"
/>
<property
name="numeroID"
column="NUM_ID_PERS"
type="string"
not-null="false"
length="50"
/>
<property
name="dateID"
column="DATE_ID_PERS"
type="date"
not-null="false"
length="7"
/>
<property
name="lieuID"
column="LIEU_ID_PERS"
type="string"
not-null="false"
length="50"
/>
<property
name="codeUti"
column="CODE_UTI"
type="string"
not-null="false"
length="25"
/>
<property
name="dteUti"
column="DTE_UTI"
type="date"
not-null="false"
length="7"
/>
<property
name="codeUtiModif"
column="CODE_UTI_MODIF"
type="string"
not-null="false"
length="25"
/>
<property
name="dteUtiModif"
column="DTE_UTI_MODIF"
type="date"
not-null="false"
length="7"
/>
<discriminator column="TYPE_PERS" type="string" />
<subclass name="Declarant" discriminator-value="DE">
</subclass>
<subclass name="Beneficiaire" discriminator-value="BE">
<many-to-one
name="idTransaction"
column="ID_TRANSACTION"
class="com.cmp.iard.sinistre.hbm.evaluation.Transaction"
not-null="false"
>
</many-to-one>
<many-to-one
name="codeTypeBeneficiaire"
column="CODE_TYPE_BENEFICIAIRE"
class="com.cmp.iard.sinistre.hbm.ref.TypeBeneficiaire"
not-null="false"
>
</many-to-one>
<property
name="estTransige"
column="EST_TRANSIGE"
type="string"
/>
</subclass>
<subclass name="Adversaire" discriminator-value="AD">
<!--
<property
name="codePers"
column="CODE_PERS"
type="string"
not-null="true"
length="25"
/>
<property
name="codeSousDossier"
column="CODE_SOUS_DOSSIER"
type="string"
not-null="true"
length="25"
/>
-->
</subclass>
<subclass name="Temoin" discriminator-value="TE">
<!--
<property
name="codePers"
column="CODE_PERS"
type="string"
not-null="true"
length="25"
/>
<property
name="codeSousDossier"
column="CODE_SOUS_DOSSIER"
type="string"
not-null="true"
length="25"
/>
-->
</subclass>
</class>
</hibernate-mapping>
here is the table :
CREATE TABLE SYS.NOYS_PERSONNE
(
CODE_PERS VARCHAR2(25 BYTE) NOT NULL,
CODE_OBJ_PARAM_SINISTRE VARCHAR2(25 BYTE),
CODE_MISSION_EXPERT VARCHAR2(25 BYTE),
CODE_PROF VARCHAR2(25 BYTE),
NOM_PERS VARCHAR2(100 BYTE),
LOCALISATION_PERS VARCHAR2(100 BYTE),
TELEPHONE_PERS VARCHAR2(100 BYTE),
ADRESSE_PERS VARCHAR2(100 BYTE),
TYPE_PERS VARCHAR2(5 BYTE),
TITRE_PERS VARCHAR2(25 BYTE),
DATE_NAISS_PERS DATE,
LIEU_NAISS_PERS VARCHAR2(50 BYTE),
NUM_PERMIS_PERS VARCHAR2(50 BYTE),
CATEG_PERMIS_PERS VARCHAR2(50 BYTE),
NUM_ID_PERS VARCHAR2(50 BYTE),
DATE_ID_PERS DATE,
LIEU_ID_PERS VARCHAR2(50 BYTE),
CODE_UTI VARCHAR2(25 BYTE),
DTE_UTI DATE,
CODE_UTI_MODIF VARCHAR2(25 BYTE),
DTE_UTI_MODIF DATE,
ID_TRANSACTION VARCHAR2(25 BYTE),
CODE_SOUS_DOSSIER VARCHAR2(25 BYTE),
CODE_TYPE_BENEFICIAIRE VARCHAR2(25 BYTE),
EST_TRANSIGE VARCHAR2(1 BYTE)
)
Here are the constraints applied to the table :
-
-- Foreign Key Constraints for Table NOYS_PERSONNE
--
ALTER TABLE SYS.NOYS_PERSONNE ADD (
CONSTRAINT FK_NOYS_PER_ASS29_NOYS_MIS
FOREIGN KEY (CODE_MISSION_EXPERT)
REFERENCES SYS.NOYS_MISSION_EXPERT (CODE_MISSION_EXPERT));
ALTER TABLE SYS.NOYS_PERSONNE ADD (
CONSTRAINT FK_NOYS_PER_TYPEPIECE_NOYPS_PA
FOREIGN KEY (CODE_OBJ_PARAM_SINISTRE)
REFERENCES SYS.NOYPS_PARAMSINISTRE (CODE_OBJ_PARAM_SINISTRE));
ALTER TABLE SYS.NOYS_PERSONNE ADD (
CONSTRAINT NOYS_PERSONNE_R03
FOREIGN KEY (CODE_PROF)
REFERENCES OMEFIRE.NOYP_PROFESSION (CODE_PROF));
ALTER TABLE SYS.NOYS_PERSONNE ADD (
FOREIGN KEY (CODE_SOUS_DOSSIER)
REFERENCES SYS.NOYS_SOUS_DOSSIER (CODE_SOUS_DOSSIER));
ALTER TABLE SYS.NOYS_PERSONNE ADD (
FOREIGN KEY (ID_TRANSACTION)
REFERENCES SYS.NOYS_TRANSACTION (ID_TRANSACTION));
ALTER TABLE SYS.NOYS_ADVERSAIRE ADD (
CONSTRAINT FK_NOYS_ADV_GENERALIS_NOYS_PER
FOREIGN KEY (CODE_PERS)
REFERENCES SYS.NOYS_PERSONNE (CODE_PERS));
ALTER TABLE SYS.NOYS_SINISTRE_BASE ADD (
CONSTRAINT FK_NOYS_SIN_DECLARANT_NOYS_PER
FOREIGN KEY (CODE_PERS)
REFERENCES SYS.NOYS_PERSONNE (CODE_PERS));
ALTER TABLE SYS.NOYS_TEMOIN ADD (
CONSTRAINT FK_NOYS_TEM_GENERALIS_NOYS_PER
FOREIGN KEY (CODE_PERS)
REFERENCES SYS.NOYS_PERSONNE (CODE_PERS));
ALTER TABLE SYS.NOYS_DETAIL_DECOMPTE ADD (
FOREIGN KEY (CODE_PERS)
REFERENCES SYS.NOYS_PERSONNE (CODE_PERS));
whenever I try to run this from Eclipse, I get the following error :
11:09:01,718 INFO [Configuration] Searching for mapping documents in jar: AfrikBrain.AssurHibernate.har
11:09:01,718 INFO [Configuration] Found mapping document in jar: com/afrikbrain/iard/sinistre/hbm/dossier/NoysAssDeclPtEval.hbm.xml
11:09:01,750 INFO [HbmBinder] Mapping class: com.afrikbrain.iard.sinistre.hbm.dossier.PointsEvaluationDeclaration -> NOYS_ASS_DECL_PT_EVAL
11:09:01,765 INFO [Configuration] Found mapping document in jar: com/afrikbrain/iard/sinistre/hbm/dossier/NoysCausesAnnexesSinistre.hbm.xml
11:09:01,781 INFO [HbmBinder] Mapping class: com.afrikbrain.iard.sinistre.hbm.dossier.CausesAnnexesSinistre -> NOYS_CAUSESANNEXES_SINISTRE
11:09:01,781 INFO [Configuration] Found mapping document in jar: com/afrikbrain/iard/sinistre/hbm/dossier/NoysDeclarationAuto.hbm.xml
11:09:01,796 INFO [HbmBinder] Mapping class: com.afrikbrain.iard.sinistre.hbm.dossier.DeclarationAuto -> NOYS_DECLARATION_AUTO
11:09:01,796 INFO [Configuration] Found mapping document in jar: com/afrikbrain/iard/sinistre/hbm/dossier/NoysDerogation.hbm.xml
11:09:01,796 INFO [HbmBinder] Mapping class: com.afrikbrain.iard.sinistre.hbm.dossier.Derogation -> NOYS_DEROGATION
11:09:01,812 INFO [Configuration] Found mapping document in jar: com/afrikbrain/iard/sinistre/hbm/dossier/NoysMissionExpert.hbm.xml
11:09:01,812 INFO [HbmBinder] Mapping class: com.afrikbrain.iard.sinistre.hbm.dossier.MissionExpert -> NOYS_MISSION_EXPERT
11:09:01,812 INFO [Configuration] Found mapping document in jar: com/afrikbrain/iard/sinistre/hbm/dossier/NoysMotifdero.hbm.xml
11:09:01,828 INFO [HbmBinder] Mapping class: com.afrikbrain.iard.sinistre.hbm.dossier.MotifDerogation -> NOYS_MOTIFDERO
11:09:01,828 INFO [Configuration] Found mapping document in jar: com/afrikbrain/iard/sinistre/hbm/dossier/NoysMotifrefus.hbm.xml
11:09:01,843 INFO [HbmBinder] Mapping class: com.afrikbrain.iard.sinistre.hbm.dossier.Motifrefus -> NOYS_MOTIFREFUS
11:09:01,843 INFO [Configuration] Found mapping document in jar: com/afrikbrain/iard/sinistre/hbm/dossier/NoysPersonne.hbm.xml
11:09:01,843 ERROR [XMLHelper] Error parsing XML: XML InputStream(288) The content of element type "class" must match "(meta*,subselect?,cache?,synchronize*,comment?,tuplizer*,(id|composite-id),discriminator?,natural-id?,(version|timestamp)?,(property|many-to-one|one-to-one|component|dynamic-component|properties|any|map|set|list|bag|idbag|array|primitive-array)*,((join*,subclass*)|joined-subclass*|union-subclass*),loader?,sql-insert?,sql-update?,sql-delete?,filter*,resultset*,(query|sql-query)*)".
11:09:01,859 WARN [ServiceController] Problem starting service AssurHibernate.har:service=Hibernate
org.hibernate.InvalidMappingException: Could not read mapping documents from jar: AfrikBrain.AssurHibernate.har
at org.hibernate.cfg.Configuration.addJar(Configuration.java:621)
at org.jboss.hibernate.jmx.Hibernate.handleMappings(Hibernate.java:318)
at org.jboss.hibernate.jmx.Hibernate.buildConfiguration(Hibernate.java:208)
at org.jboss.hibernate.jmx.Hibernate.buildSessionFactory(Hibernate.java:228)
at org.jboss.hibernate.jmx.Hibernate.startService(Hibernate.java:155)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
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:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
at $Proxy0.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:417)
at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy4.start(Unknown Source)
at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy10.deploy(Unknown Source)
at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from invalid mapping
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:502)
at org.hibernate.cfg.Configuration.addJar(Configuration.java:618)
... 50 more
Caused by: org.xml.sax.SAXParseException: The content of element type "class" must match "(meta*,subselect?,cache?,synchronize*,comment?,tuplizer*,(id|composite-id),discriminator?,natural-id?,(version|timestamp)?,(property|many-to-one|one-to-one|component|dynamic-component|properties|any|map|set|list|bag|idbag|array|primitive-array)*,((join*,subclass*)|joined-subclass*|union-subclass*),loader?,sql-insert?,sql-update?,sql-delete?,filter*,resultset*,(query|sql-query)*)".
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.dom4j.io.SAXReader.read(SAXReader.java:465)
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:499)
... 51 more
11:09:01,875 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
--- MBeans waiting for other MBeans ---
ObjectName: AssurHibernate.har:service=Hibernate
State: FAILED
Reason: org.hibernate.InvalidMappingException: Could not read mapping documents from jar: AfrikBrain.AssurHibernate.har
--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
ObjectName: AssurHibernate.har:service=Hibernate
State: FAILED
Reason: org.hibernate.InvalidMappingException: Could not read mapping documents from jar: AfrikBrain.AssurHibernate.har
what's wrong with my .hbm.xml file ?