希望用Annotation注解来做问题1
首先是List集合的
原来的 FormField类:/**
* 表单域
* @hibernate.class table="T_FormField"
*/
public class FormField {
/**
* @hibernate.id
* generator-class="native"
*/
private int id;
/**
* 表单域标签
* @hibernate.property
*/
private String fieldLabel;
/**
* 表单域的名称
* @hibernate.property
*/
private String fieldName;
/**
* 表单域的输入形式
* @hibernate.many-to-one
*/
private FieldInput fieldInput;
/**
* 表单域的类型
* @hibernate.many-to-one
*/
private FieldType fieldType;
/**
* 额外参数,条目
* 比如:如果是下拉框,都有哪些值可供选择
* @hibernate.list table="T_FieldItem"
* @hibernate.key column="fieldId"
* @hibernate.list-index column="itemIndex"
* @hibernate.composite-element class="com.bjsxt.oa.model.FieldItem"
*/
private List items;
…………………………省略
FieldItem类:
这个类是没有被@entity的
public class FieldItem {
/**
* 文本
* @hibernate.property
*/
private String label;
/**
* 值
* @hibernate.property
*/
private String value;
……………………………省略而现在的目的是用hibernate annotation来实现这个表的创建
————————————————————————————————————————
问题2:
Map集合:
Document类:
/**
* 公文
* @author Administrator
* @hibernate.class table="T_Document"
*/
public class Document {
public final static String STATUS_NEW = "新建";
public final static String STATUS_END = "完成";
/**
* @hibernate.id
* generator-class="native"
*/
private int id;
/**
* 标题
* @hibernate.property
*/
private String title;
/**
* 描述
* @hibernate.property
*/
private String description;
/**
* 公文内容,即上传文件的内容,
* 这些上传文件的内容将会被保存到数据库
* @hibernate.property
* type="binary"
* length="99999999"
*/
private byte[] content;
/**
* 创建者
* @hibernate.many-to-one
*/
private User creator;
/**
* 创建时间
* @hibernate.property
*/
private Date createTime;
/**
* 公文所走的流程
* @hibernate.many-to-one
*/
private Workflow workflow;
/**
* 流程实例的标识
* @hibernate.property
*/
private long processInstanceId;
/**
* 公文的当前状态信息:
* 只有新建状态的公文,才可以被更新和删除
* 只有已完成状态的公文,才可以被归档
* @hibernate.property
*/
private String status;
/**
* 表单的动态属性,key:String , value: DocumentProperty
* @hibernate.map table="T_Document_Properties"
* @hibernate.key column="documentId"
* @hibernate.map-key type="string" column="propertyName"
* @hibernate.composite-element class="com.bjsxt.oa.model.DocumentProperty"
*/
private Map props;
……………………省略DocumentProperty类:
同样这个类是没有被@entity的public class DocumentProperty { /**
* @hibernate.property
*/
private String java_lang_String; /**
* @hibernate.property
*/
private Integer java_lang_Integer; /**
* @hibernate.property type="binary" length="99999999"
*/
private byte[] java_io_File;
……………………………………………………省略
犹豫困扰很久了。希望高手能解答一下。感激不尽
这两个集合都用Annotation注解来实现,。
首先是List集合的
原来的 FormField类:/**
* 表单域
* @hibernate.class table="T_FormField"
*/
public class FormField {
/**
* @hibernate.id
* generator-class="native"
*/
private int id;
/**
* 表单域标签
* @hibernate.property
*/
private String fieldLabel;
/**
* 表单域的名称
* @hibernate.property
*/
private String fieldName;
/**
* 表单域的输入形式
* @hibernate.many-to-one
*/
private FieldInput fieldInput;
/**
* 表单域的类型
* @hibernate.many-to-one
*/
private FieldType fieldType;
/**
* 额外参数,条目
* 比如:如果是下拉框,都有哪些值可供选择
* @hibernate.list table="T_FieldItem"
* @hibernate.key column="fieldId"
* @hibernate.list-index column="itemIndex"
* @hibernate.composite-element class="com.bjsxt.oa.model.FieldItem"
*/
private List items;
…………………………省略
FieldItem类:
这个类是没有被@entity的
public class FieldItem {
/**
* 文本
* @hibernate.property
*/
private String label;
/**
* 值
* @hibernate.property
*/
private String value;
……………………………省略而现在的目的是用hibernate annotation来实现这个表的创建
————————————————————————————————————————
问题2:
Map集合:
Document类:
/**
* 公文
* @author Administrator
* @hibernate.class table="T_Document"
*/
public class Document {
public final static String STATUS_NEW = "新建";
public final static String STATUS_END = "完成";
/**
* @hibernate.id
* generator-class="native"
*/
private int id;
/**
* 标题
* @hibernate.property
*/
private String title;
/**
* 描述
* @hibernate.property
*/
private String description;
/**
* 公文内容,即上传文件的内容,
* 这些上传文件的内容将会被保存到数据库
* @hibernate.property
* type="binary"
* length="99999999"
*/
private byte[] content;
/**
* 创建者
* @hibernate.many-to-one
*/
private User creator;
/**
* 创建时间
* @hibernate.property
*/
private Date createTime;
/**
* 公文所走的流程
* @hibernate.many-to-one
*/
private Workflow workflow;
/**
* 流程实例的标识
* @hibernate.property
*/
private long processInstanceId;
/**
* 公文的当前状态信息:
* 只有新建状态的公文,才可以被更新和删除
* 只有已完成状态的公文,才可以被归档
* @hibernate.property
*/
private String status;
/**
* 表单的动态属性,key:String , value: DocumentProperty
* @hibernate.map table="T_Document_Properties"
* @hibernate.key column="documentId"
* @hibernate.map-key type="string" column="propertyName"
* @hibernate.composite-element class="com.bjsxt.oa.model.DocumentProperty"
*/
private Map props;
……………………省略DocumentProperty类:
同样这个类是没有被@entity的public class DocumentProperty { /**
* @hibernate.property
*/
private String java_lang_String; /**
* @hibernate.property
*/
private Integer java_lang_Integer; /**
* @hibernate.property type="binary" length="99999999"
*/
private byte[] java_io_File;
……………………………………………………省略
犹豫困扰很久了。希望高手能解答一下。感激不尽
这两个集合都用Annotation注解来实现,。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货