自己的项目没有测通  可能是自己项目原因——因为自己项目中级联关系的类涉及太多

自己的项目【这样的配置报错】

@OneToMany(fetch=FetchType.LAZY,cascade = { CascadeType.REMOVE }, mappedBy="scProjectTecApply")
@JoinColumn(name="busid")
public List<ScTeam> getTeams() {
return teams;
}

【修改后配置】

@OneToMany(fetch=FetchType.LAZY,cascade = { CascadeType.REMOVE }, mappedBy="scProjectTecApply")
public List<ScTeam> getTeams() {
return teams;
=======================报错

could not initialize a collection:

[com.jspxcms.core.domain.ScProjectTecApply.teams#2098];

SQL [select teams0_.scProjectTecApply as scProjec6_77_1_, teams0_.id as id1_, teams0_.id as id80_0_, teams0_.busid as busid80_0_, teams0_.deptname as deptname80_0_, teams0_.leader as leader80_0_, teams0_.points as points80_0_, teams0_.scProjectTecApply as scProjec6_80_0_, teams0_.uname as uname80_0_, teams0_.weight_sort as weight8_80_0_ from sc_team teams0_ where teams0_.scProjectTecApply=?];

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'teams0_.scProjectTecApply' in 'field list'

=============

【修改为这样】仍然报错

@OneToMany(fetch=FetchType.LAZY,cascade = { CascadeType.REMOVE })
@JoinColumn(name="busid")
public List<ScTeam> getTeams() {
return teams;
}

could not initialize a collection:

[com.jspxcms.core.domain.ScProjectTecApply.teams#2098];

SQL [select teams0_.busid as busid77_1_, teams0_.id as id1_, teams0_.id as id80_0_, teams0_.busid as busid80_0_, teams0_.deptname as deptname80_0_, teams0_.leader as leader80_0_, teams0_.points as points80_0_, teams0_.scProjectTecApply as scProjec6_80_0_, teams0_.uname as uname80_0_, teams0_.weight_sort as weight8_80_0_ from sc_team teams0_ where teams0_.busid=?]; 
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'teams0_.scProjectTecApply' in 'field list'

=====================

【网上资料】

异常:Associations marked as mappedBy must not define database mappings like @JoinTable or @JoinColumn
错误发生在下面这些代码中
@OneToMany(mappedBy="parent",fetch=FetchType.EAGER,cascade=CascadeType.ALL)
@JoinColumn(name="parent_id")
private List<Category> child = new ArrayList<Category>();
后来发现在3.5.3版本中@JoinColumn与mappingBy是互斥的,之前在hibernate.3.3.2中都是正确无误的,也就是hibernate.3.3.2允许这两个互相存在。
所以,如果升级到hibernate3.5.3想测试成功的话,mappBy="parent",就应该去掉,正确的配置应该是这样
@OneToMany(fetch=FetchType.EAGER,cascade=CascadeType.ALL)
@JoinColumn(name="parent_id")
private List<Category> child = new ArrayList<Category>();

Associations marked as mappedBy must not define database mappings like @JoinTable or @JoinColumn【报错】的更多相关文章

  1. pycharm的Database连接新的Mysql5.7报错[08001]

    在URL的后面增加参数: ?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC 解决. 原因是虽然mysql5.7的s ...

  2. 数据库迁移(创建关联等操作) Target database is not up to date报错

    使用Mysql-sqlalchemy执行数据库迁移 来更新数据库: 队长试探性的在网上找了几种方案 依然没有解决报错问题: 后来看了https://www.aliyun.com/jiaocheng/4 ...

  3. 【JDBC 报错】Connections could not be acquired from the underlying database!

    项目启动报错: [2016-07-13 10:04:15,074] ERROR org.apache.ibatis.executor.BaseExecutor Could not get a data ...

  4. Sqlite 数据库出现database disk image is malformed报错的解决方法

    软件用的是Sqlite数据库,昨天还好好的,今天开机登录软件报错:database disk image is malformed 用Sqlite Expert Personal 重建索引,发现其中一 ...

  5. 配置recovery_min_apply_delay后重启standby节点报错:psql: FATAL: the database system is starting up

    环境: pg版本:PostgreSQL 9.4.4 on x86_64 系统版本:CentOS release 6.6 linux内核版本:2.6.32-504.8.1.el6.x86_64 今天测试 ...

  6. sqlite 报错:database is locked

    在sqlite批量添加数据时,报错:database is locked. 解决办法:将db路径由相对路径设置为绝对路径.

  7. hive报错 Another instance of Derby may have already booted the database

    刚装好hive后,启动之后showtables;等正常,退出之后再进入,就发现会报错 Caused by: ERROR XSDB6: Another instance ofDerbymay have ...

  8. Table '.\mysql\proc' is marked as crashed and should be repaired 报错

    Table '.\mysql\proc' is marked as crashed and should be repaired 报错 解决方法: 找到mysql的安装目录的bin/myisamchk ...

  9. GTID复制报错处理:Last_Error: Error 'Can't drop database 'test'; database doesn't exist' on query

    创建GTID主从连接: mysql, master_user; 报错显示: Slave_IO_Running: Yes Slave_SQL_Running: No Last_Error: Error ...

随机推荐

  1. Anaconda 环境中使用pip安装时候出现的一些问题

    author:pprp date:18/8/12 --- 1. AttributeError: Module Pip has no attribute 'main' solution:降低pip的版本 ...

  2. 从0开始 数据结构 AC自动机 hdu 2222

    参考博客 失配指针原理 使当前字符失配时跳转到另一段从root开始每一个字符都与当前已匹配字符段某一个后缀完全相同且长度最大的位置继续匹配,如同KMP算法一样,AC自动机在匹配时如果当前字符串匹配失败 ...

  3. Docker run 挂载 volume 记录

     docker run -i -t -v /f/a:/f/ centos:7 /bin/bash -v 本地路径 : 挂载到 centos 中  f 文件夹 中 windows10 中  不能使用 f ...

  4. NPM Scripts 2 -- rimraf copyfiles imagemin usemin htmlmin uglifyjs

    NPM Scripts Part 2 Objectives and Outcomes In this exercise you will learn to build a distribution f ...

  5. Sql Server中的DBCC命令详细介绍

    一:DBCC 1:什么是DBCC 我不是教学老师,我也说不到没有任何无懈可击的定义,全名:Database Console Commands.顾名思义“数据库控制台命令”,说到“控制台“,我第一反应就 ...

  6. Windows command line monitor

    一个可以查看当然系统中进程参数的小工具 下载地址

  7. Java 9的JDK中值得期待的:不仅仅是模块化

    在多次延期后,Java 9将于9月21日以Java开发工具包9的形式出现,这是自2014年3月以来,Java标准版的第一次重大升级.官方列出了JDK 9的大约90个新特性,模块化是最主要的一个.将Ja ...

  8. Python绘图技巧

    转自:https://www.cnblogs.com/zhizhan/p/5615947.html Python--matplotlib绘图可视化知识点整理 强烈推荐ipython 原文:http:/ ...

  9. HDU 1198 Farm Irrigation(并查集+位运算)

    Farm Irrigation Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other) Tot ...

  10. js 计算时间

    var date1=new Date();  //开始时间   var date2=new Date();    //结束时间 var date3=date2.getTime()-date1.getT ...