facebook

Hibernate Mapping

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #217036 Reply

    tzman
    Member

    I generated a hibernate dao and mapping file from the DB Explorer context menu “Create Hibernate Mapping”. I have updated to MyEclipse 3.8.2.

    In the wizard I found the package I want the dao to go into through browsing and generated the files. When I go to run the test code I get the following error.

    2078 [main] DEBUG net.sf.hibernate.util.DTDEntityResolver – trying to locate http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd in classpath under net/sf/hibernate/
    2094 [main] DEBUG net.sf.hibernate.util.DTDEntityResolver – found http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd in classpath
    2266 [main] ERROR net.sf.hibernate.util.XMLHelper – Error parsing XML: XML InputStream(9) Attribute “package” is not declared for element “hibernate-mapping”.
    2609 [main] ERROR net.sf.hibernate.cfg.Configuration – Could not compile the mapping document

    It seems as though I am missing some configuration for MyEclipse. Any help would be greatly appreciated.

    Thanks.

    Here is the generated mapping file.

    <?xml version=”1.0″?>
    <!DOCTYPE hibernate-mapping PUBLIC
    “-//Hibernate/Hibernate Mapping DTD 2.0//EN”
    http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd&#8221; >

    <!– DO NOT EDIT: This is a generated file that is synchronized –>
    <!– by MyEclipse Hibernate tool integration. –>
    <!– Created Wed Oct 06 13:02:13 CDT 2004 –>
    <hibernate-mapping package=”inlhh.da.dao.comp”>

    <class name=”AdiComp” table=”ADI_COMP”>
    <id name=”compScac” column=”COMP_SCAC” type=”java.lang.String”>
    <generator class=”assigned”/>
    </id>

    <property name=”compKey” column=”COMP_KEY” type=”java.lang.Long” not-null=”true” />
    <property name=”compName” column=”COMP_NAME” type=”java.lang.String” not-null=”true” />
    <property name=”parCompScac” column=”PAR_COMP_SCAC” type=”java.lang.String” not-null=”true” />
    <property name=”dnbr” column=”DNBR” type=”java.lang.String” not-null=”true” />
    <property name=”rampOprInd” column=”RAMP_OPR_IND” type=”java.lang.String” not-null=”true” />
    <property name=”shprInd” column=”SHPR_IND” type=”java.lang.String” not-null=”true” />
    <property name=”inspCompInd” column=”INSP_COMP_IND” type=”java.lang.String” not-null=”true” />
    <property name=”haulInd” column=”HAUL_IND” type=”java.lang.String” not-null=”true” />
    <property name=”railInd” column=”RAIL_IND” type=”java.lang.String” not-null=”true” />
    <property name=”contEffTmst” column=”CONT_EFF_TMST” type=”java.util.Date” not-null=”true” />
    <property name=”contEffMicr” column=”CONT_EFF_MICR” type=”java.lang.Integer” not-null=”true” />
    <property name=”contExpnTmst” column=”CONT_EXPN_TMST” type=”java.util.Date” not-null=”true” />
    <property name=”contExpnMicr” column=”CONT_EXPN_MICR” type=”java.lang.Integer” not-null=”true” />
    <property name=”upVndrPymtCode” column=”UP_VNDR_PYMT_CODE” type=”java.lang.String” not-null=”true” />
    <property name=”tcsFirmNbr” column=”TCS_FIRM_NBR” type=”java.lang.String” not-null=”true” />
    <property name=”contId” column=”CONT_ID” type=”java.lang.String” not-null=”true” />
    <property name=”lastMdfdTmst” column=”LAST_MDFD_TMST” type=”java.util.Date” not-null=”true” />
    <property name=”lastMdfdMicr” column=”LAST_MDFD_MICR” type=”java.lang.Integer” not-null=”true” />
    <property name=”lastMdfdBy” column=”LAST_MDFD_BY” type=”java.lang.String” not-null=”true” />
    <property name=”trkLoadNbrScem” column=”TRK_LOAD_NBR_SCEM” type=”java.lang.String” not-null=”true” />
    </class>

    </hibernate-mapping>

    #217046 Reply

    Riyad Kalla
    Member

    Mapping file looks kosher… checking with dev.

    #217068 Reply

    support-jeff
    Member

    Narry a clue. All looks right and proper to me. The package attribute is there and everything. Perhaps do you have some conflicting XML parsers or other libraries in your classpath?

    #217119 Reply

    tzman
    Member

    The package attribute is not in my hibernate-mapping-2.0.dtd file.

    Here is the root document portion of my DTD, taken from Hibernate’s 2.1 source distribution.

    <!ELEMENT hibernate-mapping (meta*, import*, (class|subclass|joined-subclass)*, query*, sql-query*)>
    <!ATTLIST hibernate-mapping schema CDATA #IMPLIED> <!– default: none –>
    <!ATTLIST hibernate-mapping default-cascade (none|save-update|all) “none”>
    <!ATTLIST hibernate-mapping auto-import (true|false) “true”>

    Is there some type of conversion that should be being done on the package statement, or a different DTD I should be using?

    Thanks.

    #217199 Reply

    support-jeff
    Member

    Are you using your own hibernate libraries, or did you use those supplied with MyEclipse – adding them to your project using the add capabilities wizard? If the former, you probably have an incompatible version. I would suggest using the libs provided by ME, since those will work. If you are unable to do so, try making your class name fully-qualified in the mapping file:
    <hibernate-mapping>
    <class name=”inlhh.da.dao.comp.AdiComp” table=”ADI_COMP”>

    See if that works.

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: Hibernate Mapping

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