因为我的hibernate映射表没有主键所以报这个错。

解决方案是:

  1、创建一个主键

  2、hibernate处理无主键的表的映射问题,其实很简单,就是把一条记录看成一个主键,即组合主键<composite-id>。

  注意:使用虚拟联合主键的话,实体类必须实现序列化接口:

  org.hibernate.MappingException: Composite-id class must implement Serializable: cn.itcast.domain.Counter

< hibernate-mapping >
< class name = "com.cqgl.po.SaI18nLimitRulesPO" table = "SA_I18N_LIMIT_RULES" >
< composite-id >
< key-property name = "aircompanyCode" type = "java.lang.String" >
< column name = "AIRCOMPANY_CODE" />
</ key-property > < key-property name = "aircompanyName" type = "java.lang.String" >
< column name = "AIRCOMPANY_NAME" />
</ key-property > ...... </ composite-id >
</ class >
</ hibernate-mapping >

org.hibernate.AnnotationException: No identifier specified for entity: cn.itcast.domain.Counter的更多相关文章

  1. JPA error org.hibernate.AnnotationException: No identifier specified for entity

    错误:org.hibernate.AnnotationException: No identifier specified for entity 原因:JPA所使用的Entity需要标注@Id,在引用 ...

  2. 报错Caused by: org.hibernate.AnnotationException: No identifier specified for entity:

    Caused by: org.hibernate.AnnotationException: No identifier specified for entity:. 原因: 1.没有给实体类ID 解决 ...

  3. Springboot- Caused by: org.hibernate.AnnotationException: No identifier specified for entity:

    错误与异常: Caused by: org.hibernate.AnnotationException: No identifier specified for entity: 原因:引用了不对的包, ...

  4. org.hibernate.AnnotationException: No identifier specified for entity: com.example1.demo1.Entity.User错误

    最近在公司带人,他们问我的问题在这里也顺便总结下. 此项目为SpringDataJpa项目. 出现的错误如下: Caused by: org.hibernate.AnnotationException ...

  5. org.hibernate.AnnotationException: No identifier specified for entity:

    使用hibernate的e-r映射pojo类的时候遇到org.hibernate.AnnotationException: No identifier specified for entity的异常, ...

  6. org.hibernate.AnnotationException: No identifier specified for entity 错误解决

    主键对应的属性上加上@Id注解,对应javax.persistence.Id @Id private Long id;

  7. 解决Entity 实体类中加了@Id 注解后仍然出现org.hibernate.AnnotationException: No identifier specified for entity 错误

    启动报错如下图所示: 解决方案: 查看网上的资料,大部分都说在实体类中没有添加加主键的注解@Id,这个是必须的.但是我的实体类中明明已经添加了@Id,为什么还会报这个错误呢? 后来检查了很久,发现是我 ...

  8. Entity 类中加了@Id 注解后仍然出现org.hibernate.AnnotationException: No identifier specified for entity 错误

    查看网上的资料,应该是报错的实体类com.example.domain.p.User中没有添加加主键的注解@Id,这个是必须的.但是我的实体类中明明已经添加了@Id,为什么还会报这个错误呢? 后来检查 ...

  9. hibernate出现 org.hibernate.PropertyNotFoundException: field [departmen] not found on cn.itcast.hibernate.domain.Employee1错误

    hibernate出现 org.hibernate.PropertyNotFoundException: field [departmen] not found on cn.itcast.hibern ...

随机推荐

  1. nginx js、css多个请求合并为一个请求(concat模块)

    模块介绍 mod_concat模块由淘宝开发,目前已经包含在tengine中,并且淘宝已经在使用这个nginx模块.不过塔暂时没有包含在nginx中.这个模块类似于apache中的modconcat. ...

  2. Dungeon Game

    The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. ...

  3. opal 将ruby代码转化成javascript

    点这里 https://github.com/opal Opal    Opal is a ruby to javascript source-to-source compiler. It also ...

  4. XCODE快捷键个人总结

    1.在方法名上用CMD+左键 可以查看完整的方法名

  5. WebSocket 是什么原理?为什么可以实现持久连接

    你可以把 WebSocket 看成是 HTTP 协议为了支持长连接所打的一个大补丁,它和 HTTP 有一些共性,是为了解决 HTTP 本身无法解决的某些问题而做出的一个改良设计.在以前 HTTP 协议 ...

  6. web.xml文件中加载顺序的优先级

    在项目中总会遇到一些关于加载的优先级问题,近期也同样遇到过类似的,所以自己查找资料总结了下,下面有些是转载其他人的,毕竟人家写的不错,自己也就不重复造轮子了,只是略加点了自己的修饰. 首先可以肯定的是 ...

  7. VS编译的QT程序发布时产生的AppCrash问题

    至少我碰到了三个情况,都是AppCrash错误(以下都指VS2008的Release的设置) 第1个错误,报错模块是程序自己 我使用VS2008 Team with SP1和QT4.86编译程序,一直 ...

  8. 317. Shortest Distance from All Buildings

    题目: Given a string array words, find the maximum value of length(word[i]) * length(word[j]) where th ...

  9. Centos挂载windows共享文件夹

    1.windows7共享一个文件夹(1)新建一个用户:devin,密码:admin123(2)在E盘新建一个文件夹,share,并设置共享 对用户devin共享,并让其权限为:读取和写入. 2.lin ...

  10. 统计MySQL数据表大小

    SELECT CONCAT(TRUNCATE(SUM(data_length)/1024/1024,2),'MB') AS data_size,CONCAT(TRUNCATE(SUM(max_data ...