Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/311.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
使用Java代码设置Hibernate映射值_Java_Hibernate - Fatal编程技术网

使用Java代码设置Hibernate映射值

使用Java代码设置Hibernate映射值,java,hibernate,Java,Hibernate,我想使用Java代码设置Hibernate配置: <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <hibernate-configuration>

我想使用Java代码设置Hibernate配置:

<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
                          "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
    <session-factory>
        <property name="hibernate.show_sql">true</property>
        .........................
        <property name="hibernate.hbm2ddl.auto">update</property>

        <mapping class="com.web.models.RfidReaderModel"/>
        <mapping class="com.web.models.SensorModel"/>
        <mapping class="com.web.models.WhiteListModel"/>
        <mapping class="com.web.models.BlackListModel"/>
        <mapping class="com.web.models.ClientCardModel"/>
        <mapping class="com.web.models.SystemUserModel"/>
        <mapping class="com.web.models.AuditLogModel"/>

        <mapping class="com.web.models.EntranceWFModel"/>
        <mapping class="com.web.models.ExitWFModel"/>
        <mapping class="com.web.models.RolesPermissions"/>
        <mapping class="com.web.models.SystemUserRole"/>
    </session-factory>
</hibernate-configuration>
但我还需要设置映射值:

<mapping class="com.web.models.EntranceWFModel"/>

如何使用Java代码设置它们?

使用,例如:

configuration.addAnnotatedClass(EntranceWFModel.class);
使用以下选项,例如:

configuration.addAnnotatedClass(EntranceWFModel.class);
相关问题:。相关问题:。