Could not determine type for: java.util.Collection, at table: 解决

简介: Could not determine type for: java.util.Collection, at table: 该错误有可能的原因是:  在实体类的属性中的annotation, 要么就全写在属性上,要么就全写在get方法上,不能混用。

Could not determine type for: java.util.Collection, at table:

该错误有可能的原因是:  在实体类的属性中的annotation, 要么就全写在属性上,要么就全写在get方法上,不能混用。

 

@Entity
@SequenceGenerator(name = "Person_Seq", sequenceName = "person_seq")
public class Person implements Serializable {

	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "Person_Seq")
	private int id;
	@Column(name = "name")
	private String name;

	// @ManyToOne
	// @JoinColumn(name="unitid")
	@ManyToOne
	@JoinColumn(name = "unitid")
	private Unit unit;
	private static final long serialVersionUID = 1L;

	public Person() {
		super();
	}

	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Unit getUnit() {
		return unit;
	}

	public void setUnit(Unit unit) {
		this.unit = unit;
	}

}

 把@ManyToOne移到getUnit上就会出错

目录
相关文章
|
21天前
Cause: java.sql.SQLIntegrityConstraintViolationException: Column ‘id‘ in field list is ambiguous
Cause: java.sql.SQLIntegrityConstraintViolationException: Column ‘id‘ in field list is ambiguous
12 0
|
6月前
|
XML 数据格式
解决 Cannot convert value of type ‘java.lang.String‘ to required type ‘java.sql.Driver‘ for property ‘
解决 Cannot convert value of type ‘java.lang.String‘ to required type ‘java.sql.Driver‘ for property ‘
118 0
|
10月前
|
Java 关系型数据库 MySQL
15. 成功解决:java: Can't generate mapping method with primitive return type.
今天启动 SpringBoot 项目时,报了如下错误:`java: Can't generate mapping method with primitive return type.`
454 0
|
11月前
|
数据库
types. Found: ‘com.baomidou.mybatisplus.annotation.IdType‘, required: ‘java.lang.String‘
被自己蠢哭了,今天设置表的主键为自动递增,就写IdType,死活报 types. Found: 'com.baomidou.mybatisplus.annotation.IdType', required: 'java.lang.String' 这个错误。
|
Java 数据库连接 mybatis
控制台报错 No constructor found in com.base.entity.Menu matching [java.lang.Integer, java.lang.String]
控制台报错 No constructor found in com.base.entity.Menu matching [java.lang.Integer, java.lang.String]
117 0
控制台报错 No constructor found in com.base.entity.Menu matching [java.lang.Integer, java.lang.String]
|
Java
java.lang.UnsupportedOperationException: This parser does not support specification “null“ version “
java.lang.UnsupportedOperationException: This parser does not support specification “null“ version “
118 0
Could not resolve element type of Iterable type xxxxx.RequestParam java.util.List<?>. Not declared?
Could not resolve element type of Iterable type xxxxx.RequestParam java.util.List<?>. Not declared?
Could not resolve element type of Iterable type xxxxx.RequestParam java.util.List<?>. Not declared?
|
Java 数据库连接
Failed to convert value of type 'java.lang.String' to required type 'java.time.LocalDate';
Failed to convert value of type 'java.lang.String' to required type 'java.time.LocalDate';
711 0
|
XML JSON 数据格式
No converter found for return value of type: class java.util.ArrayList错误问题
No converter found for return value of type: class java.util.ArrayList错误问题
No converter found for return value of type: class java.util.ArrayList错误问题
|
XML 数据格式
java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for
java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for
142 0