因为我的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. 在 Java EE 组件中使用 Camel Routes

    摘要:你可以通过集成 Camel 和 WildFly 应用服务器(使用 WildFly-Camel 子系统)在 Java EE 组件中开始使用 Apache Camel Routes. [编者按]作者 ...

  2. NodeJS介绍

    1.概述: Node.js是基于Chrome JavaScript运行时建立的一个平台,实际上它是对Google Chrome V8引擎进行了封装,它主要用于创建快速的.可扩展的网络应用.Node.j ...

  3. POJ 2101

    #include <iostream> #include <algorithm> #include <cmath> using namespace std; int ...

  4. js对象小结

    前奏 对象是js的基本数据类型,准确来说除了字符串,数字,boolean值,null与undifine之外,js中的值都是对象.js中的对象是一种复合值,他将很多值(原始值或其他对象)聚合在一起,可以 ...

  5. 唉,还是Windows好

    作为一个计算机专业的,常常抱怨Windows慢.一个系统用一段时间慢下来就重装,但是次次重装很麻烦,每次重装之后还得装软件. 另外,Windows比Linux占资源,所以前段时间就想以Linux为主要 ...

  6. servlet学习笔记四

    Servlet 主要内容: 1)servlet初始化参数与上下文参数 2)过滤器 3)监听器一.servlet初始化参数与上下文参数 1)servlet初始化参数 把某些变量放在web.xml配置,到 ...

  7. P2P金融

    P2P金融又叫P2P信贷,是互联网金融(ITFIN)的一种.意思是:点对点. P2P金融指不同的网络节点之间的小额借贷交易(一般指个人),需要借助电子商务专业网络平台帮助借贷双方确立借贷关系并完成相关 ...

  8. Geoprocessor 使用

    在AO中使用Geoprocessor(ESRI.ArcGIS.Geoprocessor) 1.观察arcmap中的使用方法,明确各参数意义. 2.arctoolbox中参数对应为features/fe ...

  9. Linux 关机命令详解

    在linux下一些常用的关机/重启命令有shutdown.halt.reboot.及init,它们都可以达到重启系统的目的,但每个命令的内部工作过程是不同的,通过本文的介绍,希望你可以更加灵活的运用各 ...

  10. linux系统主要常见目录结构

    linux系统的一切从“/”开始,并按照文件系统目录标准FHS采用树桩结构来存放文件 并定义了每个区域的用途.