Hibernate 映射文件更新

来源:互联网 发布:企业工商数据api 编辑:程序博客网 时间:2024/05/01 12:44
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"        "src/dtd/hibernate-mapping-3.0.dtd"><hibernate-mapping><!--class 元素代表持久化类-->    <!--name属性为类的全名-->    <!--table 表名,默认值是类名-->    <!--catalog 数据库的名字-->    <class name="com.sanmao.hibernate.crud.domain.Person">        <!--id为主键元素-->        <!--name 标识符属性-->        <!--length 数据库中pid 的长度-->         <!--column    pid 属性对应的字段-->        <id name="pid" length="5" column="pid" type="java.lang.Long">            <!--主键的产生器-->            <!--需要什么样的方式产生主键-->            <!--<generator class="increment"></generator>-->            <!--<generator class="assigned"></generator>-->            <!--identity要求数据库中表的主键要自增长-->            <generator class="identity"></generator>            <!--<generator class="uuid"></generator>-->            <!--<generator class="native"></generator>-->        </id>        <!--sequences-->        <!--<id name="id" type="long" column="person_id">-->            <!--<generator class="sequence">-->                <!--<param name="sequence">person_id_sequence</param>-->            <!--</generator>-->        <!--</id>-->        <!--代表一般的属性-->        <property name="name" length="20"></property>        <!--设置access设置为field 的时候,就不在调用GetSet方法-->        <!--而是利用反射直接获取属性,反射是不在乎private的-->        <!--<property name="name" length="20" access="field"></property>-->        <property name="sex" length="20" ></property>        <!--<property name="sex" length="20"  insert="false"></property>-->        <!--若为false,在insert语句中不包含该字段,该字段永远不能被插入,默认为TRUE-->        <!--<property name="name" column="'name   sex'"></property>-->        <!--当数据库表字段存在空格,需要加单引号-->        <!--formula是操作语句,不支持字符串相加,请用数据类型-->        <property name="mm" formula="pid+10"></property>    </class></hibernate-mapping>
0 0
原创粉丝点击