`
darkjune
  • 浏览: 302113 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

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

jpa 
阅读更多

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上就会出错

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics