一直用的xxx.hbm.xml, 看同事用这种方式也挺方便的,学习一下
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Entity;
import javax.persistence.Table;
@Entity
@Table(name="OBM_WORK_RESULT")
public class WorkResultEntity implements Serializable {
@Id
@Column(name="resultId", length=32)
private String id;
@Basic
@Column(name="reportContentId", length=32 )
private String reportContentId;
@Basic
@Column(name="quantity" )
private int quantity;
@Basic
@Column(name="hour" )
private int hour;
@Basic
@Column(name="issue" )
private int issue;
@Basic
@Column(name="bug" )
private int bug;
@Basic
@Column(name="createTime" )
private Date createTime;
@Basic
@Column(name="updateTime" )
private Date updateTime;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getReportContentId() {
return reportContentId;
}
public void setReportContentId(String reportContentId) {
this.reportContentId = reportContentId;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
public int getHour() {
return hour;
}
public void setHour(int hour) {
this.hour = hour;
}
public int getIssue() {
return issue;
}
public void setIssue(int issue) {
this.issue = issue;
}
public int getBug() {
return bug;
}
public void setBug(int bug) {
this.bug = bug;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
applicationContext.xml中sessionFactory要使用AnnotationSessionFactoryBean
<bean id="mySessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.HSQLDialect
</prop>
<prop key="hibernate.show_sql">
true
</prop>
</props>
</property>
<property name="annotatedClasses">
<list>
<value>org.chuck.data.model.entity.ProjectEntity</value>
<value>org.chuck.data.model.entity.WorkContentEntity</value>
<value>org.chuck.data.model.entity.WeeklyReportEntity</value>
<value>org.chuck.data.model.entity.FunctionEntity</value>
<value>org.chuck.data.model.entity.WorkResultEntity</value>
<value>org.chuck.data.model.entity.ReportContentEntity</value>
<value>org.chuck.data.model.entity.PersonEntity</value>
</list>
</property>
</bean>
分享到:
相关推荐
这个PDF用一个实例讲解了怎么来处理一对多和多对一的关系,利用anotation来设定的,很有参考价值。
hibernate-annotations相关的jar包
hibernate anotaion jpa 3.5.0-final pdf hibernate anotaion jpa 3.5.0-final pdf
spring 与hibernate_anotation的结合
NULL 博文链接:https://287854442.iteye.com/blog/746718
java anotation 注解 注释 注入 转载!!
NULL 博文链接:https://hi-beijing.iteye.com/blog/1202342
在Spring使用注释和Java配置
ML团队的注释工具 使用极端单击来创建边界框,该边界框是为协助ML团队而开发的工具。 先决条件 确保您的节点> 8,npm> 5 如何开始 npm i npm start
NULL 博文链接:https://lunzi.iteye.com/blog/1675871
NULL 博文链接:https://jeremy102.iteye.com/blog/1743919
Maven+Spring+Anotation
毕设所用的SSH框架,实现anotation零配置,bean和dao可以直接反转生成
在commit diff视图中,您可以: 在提交之前打开文件的注释视图,并追溯历史记录。 在同一提交中打开另一个文件的差异。 对于较旧的提交,垂直颜色条的颜色较深,对于较新的提交,垂直颜色条的颜色较浅(反之亦然,...
使用MyEclipse和Gradle ...(2)struts2-anotation-lib.zip 注解式开发需要用的lib包 (3)struts2-anotation_eclipse.zip 注解时开发myeclipse项目压缩 (4)struts2-anotation_Gradle.zip 注解式开发的Gradle文件压缩
ArcGIS Annotation使用帮助 英文
SAS,全称为“Standard Annotations and ...文档涵盖了特效中anotation 中script的使用方法与解释,包括了shader中使用的所有语义。 如果你还在为编写超炫的特效找不到帮助而烦恼,就赶快下载这篇帮助吧。
java-annotation-processor:JAVA注释处理器
史上最全spring以及扩展功能jar,包括了扩展的切面功能,额外的common-anotation,一次导入,永不报错!!!
BPMN(BusinessProcessModelAndNotation)- 业务流程模型和符号是有BPMI(BusinessProcessManagementInitiative)开发的一套变准的业务流程建模符号。2004年5月发布了BPMN1.0规范.BPMI于2005年9月并入OMG(The ...