facebook

Caused by: org.hibernate.MappingException: duplicate import

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #246303 Reply

    USMENDECAR
    Member

    Hello, I am trying to test an Hibernate app, but i get this error connecting to database. I have found a thread about this topic, but i cannot find any solution there :(.

    I am quite sure that it is not a paths problem, and all XML files are ok and validated. I cannot figure out what is the problem. Any suggest would be very appreciated. Thank you.

    Here is the error stack trace:

    
    org.hibernate.MappingException: Error reading resource: es/usm/prueba/consultas/CmAcaAltaCajeros.hbm.xml
        at org.hibernate.cfg.Configuration.addResource(Configuration.java:452)
        at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1263)
        at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1235)
        at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1217)
        at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1184)
    ....
    
    Caused by: org.hibernate.MappingException: duplicate import: es.usm.prueba.consultas.CmAcaAltaCajeros
        at org.hibernate.cfg.Mappings.addImport(Mappings.java:105)
        at org.hibernate.cfg.HbmBinder.bindPersistentClassCommonValues(HbmBinder.java:541)
        at org.hibernate.cfg.HbmBinder.bindClass(HbmBinder.java:488)
        at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:234)
        at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:152)
        at org.hibernate.cfg.Configuration.add(Configuration.java:362)
        at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:400)
    
    #246306 Reply

    Riyad Kalla
    Member

    Please paste the contents of your es/usm/prueba/consultas/CmAcaAltaCajeros.hbm.xml file here, the “duplicate import” error should point us in the right direction.

    #246307 Reply

    USMENDECAR
    Member

    Here is:

    
    <?xml version="1.0"?>
    <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
    <!-- 
        Mapping file autogenerated by MyEclipse - Hibernate Tools
    -->
    <hibernate-mapping>
        <class name="es.usm.prueba.consultas.CmAcaAltaCajeros" table="CM_ACA_ALTA_CAJEROS" schema="LINCES">
            <composite-id name="id" class="es.usm.prueba.consultas.CmAcaAltaCajerosId">
                <key-property name="acaCoIdCajero" type="long">
                    <column name="ACA_CO_ID_CAJERO" precision="22" scale="0" />
                </key-property>
                <key-property name="acaDsReferencia" type="string">
                    <column name="ACA_DS_REFERENCIA" length="10" />
                </key-property>
                <key-property name="acaDtCreacion" type="date">
                    <column name="ACA_DT_CREACION" length="7" />
                </key-property>
                <key-property name="acaDsUbicacion" type="string">
                    <column name="ACA_DS_UBICACION" length="300" />
                </key-property>
                <key-property name="acaDtModificacion" type="date">
                    <column name="ACA_DT_MODIFICACION" length="7" />
                </key-property>
                <key-property name="acaDsDenominacion" type="string">
                    <column name="ACA_DS_DENOMINACION" length="64" />
                </key-property>
                <key-property name="acaDsLocalidad" type="string">
                    <column name="ACA_DS_LOCALIDAD" length="50" />
                </key-property>
                <key-property name="acaDtBaja" type="date">
                    <column name="ACA_DT_BAJA" length="7" />
                </key-property>
                <key-property name="acaDtAlta" type="date">
                    <column name="ACA_DT_ALTA" length="7" />
                </key-property>
                <key-property name="uisCoIdUsuario" type="long">
                    <column name="UIS_CO_ID_USUARIO" precision="22" scale="0" />
                </key-property>
                <key-property name="acaDsCodigopostal" type="string">
                    <column name="ACA_DS_CODIGOPOSTAL" length="5" />
                </key-property>
                <key-property name="escCoIdEstadoCajero" type="long">
                    <column name="ESC_CO_ID_ESTADO_CAJERO" precision="1" scale="0" />
                </key-property>
                <key-property name="coaCoIdComunidadAutonoma" type="long">
                    <column name="COA_CO_ID_COMUNIDAD_AUTONOMA" precision="22" scale="0" />
                </key-property>
                <key-property name="prvCoIdProvincia" type="long">
                    <column name="PRV_CO_ID_PROVINCIA" precision="22" scale="0" />
                </key-property>
            </composite-id>
        </class>
    </hibernate-mapping>
    
    #246594 Reply

    Russ
    Member

    I was hoping this would have been answered and solved by now. I am getting the same error:

    
    <?xml version="1.0"?>
    <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
    <!-- 
        Mapping file autogenerated by MyEclipse - Hibernate Tools
    -->
    <hibernate-mapping>
        <class name="com.rrcorp.hibernate.Catalog" table="catalog" catalog="test">
            <id name="catalogId" type="integer">
                <column name="CatalogId" />
                <generator class="native" />
            </id>
            <property name="journal" type="string">
                <column name="Journal" length="25" />
            </property>
            <property name="publisher" type="string">
                <column name="Publisher" length="25" />
            </property>
            <property name="date" type="string">
                <column name="Date" length="25" />
            </property>
            <property name="title" type="string">
                <column name="Title" length="45" />
            </property>
            <property name="author" type="string">
                <column name="Author" length="25" />
            </property>
        </class>
    </hibernate-mapping>
    

    Can someone throw me bone? This dog does not hunt well…… 🙁

    Thanks for any suggestions.

    #246599 Reply

    Haris Peco
    Member

    aitorusm,

    You have mapping es.usm.prueba.consultas.CmAcaAltaCajeros twice in *.cfg.xml
    Try edit *.cfg.xml and remove one mapping

    Best regards

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: Caused by: org.hibernate.MappingException: duplicate import

You must be logged in to post in the forum log in