Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Hibernate 实体映射:从hbm.xml转换为orm.xml,缺少字段和属性_Hibernate_Jpa_Orm_Mapping_Hbm - Fatal编程技术网

Hibernate 实体映射:从hbm.xml转换为orm.xml,缺少字段和属性

Hibernate 实体映射:从hbm.xml转换为orm.xml,缺少字段和属性,hibernate,jpa,orm,mapping,hbm,Hibernate,Jpa,Orm,Mapping,Hbm,我是hibernate新手,必须将应用程序中的实体映射从hbm.xml转换为orm.xml。我的问题是缺少一些要正确转换的字段和属性 这是我试图转换的hbm.xml: <hibernate-mapping package="server.model.history"> <typedef name="outputType" class="org.hibernate.type.EnumType"> <param name="enumClass"

我是hibernate新手,必须将应用程序中的实体映射从hbm.xml转换为orm.xml。我的问题是缺少一些要正确转换的字段和属性

这是我试图转换的hbm.xml:

<hibernate-mapping package="server.model.history">

    <typedef name="outputType" class="org.hibernate.type.EnumType">
        <param name="enumClass">server.model.history.OutputType</param>
        <!-- Hibernate type '4' means Integer -->
        <param name="type">4</param>
    </typedef>

    <class name="ProcessOutput" table="PROCESS_OUTPUT" mutable="false">

        <id name="id" column="ID" type="server.model.id.hibernate.ProcessOutputIdUserType" access="field">
            <generator class="info.novatec.np.server.model.id.hibernate.CustomGenerator" />
        </id> 

        <discriminator column="HOST_KIND" type="string"/>

        <version name="version"
                 access="field" 
                 column="VERSION" 
                 type="integer"/>

        <property name="sequence" column="SEQUENCE" type="integer" not-null="true" unique-key="UNIQUE_SEQUENCE_CREATED_PROCESSID" access="field"/>

        <list name="variables" table="HOST_VARIABLE" cascade="all">
            <key column="FK_HOST_ID"/>
            <list-index column="INDEX" />
            <composite-element class="server.model.SimpleKeyValuePair">
                <property name="key" access="field" column="KEY" type="string" not-null="true" />
                <property name="value" access="field" column="VALUE" type="string"/>
            </composite-element>
        </list>

        <many-to-one name="process" class="ProcessStep" column="FK_PROCESS_ID" not-null="true" unique-key="UNIQUE_SEQUENCE_CREATED_PROCESSID" access="field" index="OUTPUT_FOREIGNKEY_INDEX" />

    </class>
</hibernate-mapping>

server.model.history.OutputType
4.
到目前为止,我是如何将其转换为orm.xml的:

<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
    version="1.0">

    <package>info.novatec.np.server.model.history</package>

    <entity class="ProcessOutput">
        <table name="PROCESS_OUTPUT" />

        <attributes>
            <id name="id"> 
                <column name="ID" />
            </id>

       <version name="version" ><column name="VERSION"/></version>

            <basic name="sequence">
                <column name="SEQUENCE" nullable="false"/>
            </basic>

            <many-to-one name="process" ></many-to-one>

        </attributes>
    </entity>
</entity-mappings>

info.novatec.np.server.model.history
正如你所看到的,它是不完整的,零碎的,部分是不正确的。 如何在orm.xml中编写id\u类型id\u访问和生成器类

我也没有找到与属性唯一键、类型和多对一索引等价的内容 那么鉴别器和typedef name=“…”class=“…”参数…/>…/>呢

我会很感激,如果能得到任何帮助,那将是非常棒的