自己也没怎么搭建过框架,更何况还是spring mvc的,最近在带两个实习生,正好教他们怎么搭建一个spring mvc的框架,然而我在映射表的时候,提示报错了。

实体基类:

public class BaseEntity implements Serializable{

    @Id
@GeneratedValue(strategy = GenerationType.AUTO)
protected Long id; @Column(updatable=false)
protected Date creatTime=new Date(); @Column(updatable=false)
protected String creatUser; @Column(insertable=false)
protected Date updateTime=new Date(); @Column(insertable=false)
protected String updateUser; //get,set方法
}

User类:

@Entity
@Table(name="sys_user")
public class User extends BaseEntity { private String loginName; private String userName; private String password; //get、set方法 }

代码看了感觉没问题啊,查阅国外的论坛之后得出一个结论,自己好菜啊!解决办法特别简单!!!在实体基类上加一个@MappedSuperclass

@MappedSuperclass
public class BaseEntity implements Serializable{ @Id
@GeneratedValue(strategy = GenerationType.AUTO)
protected Long id; @Column(updatable=false)
protected Date creatTime=new Date(); @Column(updatable=false)
protected String creatUser; @Column(insertable=false)
protected Date updateTime=new Date(); @Column(insertable=false)
protected String updateUser; //get,set方法 }

最新文章

  1. 使用oh-my-zsh后导致的卡顿问题
  2. fMRI数据分析处理原理及方法
  3. 01python算法--算法和数据结构是什么鬼?
  4. Chrome渲染Transition时页面闪动Bug
  5. Bus Pass
  6. JAVA生成EXCEL图表
  7. HDU 1548 A strange lift(dij+邻接矩阵)
  8. Java探秘之神秘的字符串String(二)
  9. NOIP2017划水崩盘记
  10. curl支持HTTP和https
  11. django上传图片简单验证以及自动修改图片名称
  12. 使用sessionStorage进行数据存值
  13. google protobuf VC下的使用笔记
  14. python 怎样获取toast?
  15. HTML5 <li> <ol> <ul> 用法
  16. Mongo 3.6.1版本Sharding集群配置
  17. rsyncd
  18. Java基础——工厂模式
  19. 20155308 《网络攻防》 Exp2 后门原理与实践
  20. [BZOJ 1032][JSOI 2007]祖玛 题解(区间DP)

热门文章

  1. 1.如何使用vbs打开网页并且登陆
  2. vmware虚拟机的克隆
  3. DB数据导出工具分享
  4. Android-->创建自定义控件
  5. 浅谈关于特征选择算法与Relief的实现
  6. Angular--ui-router的使用
  7. BottomupSort算法 c++代码实现
  8. Eclipse 迁移到Android studio
  9. MyBatis+mysql 简单分页
  10. 将Asp.Net Core和corefx移植到.Net 4.0