关联关系注解时报Could not determine type for错误的解决办法
来源:互联网 发布:安卓源码查看 编辑:程序博客网 时间:2024/06/05 21:51
检查所有的实体类的注解是不是都是统一写在属性上的,还是统一写在get方法上的。一定要统一。
另外如果要是所有实体类的id都是继承过来的,关键就要检查下这个id是不是跟其它注解是统一的。
如:
IdEntity.java
package com.bai.project.bean;import javax.persistence.Column;import javax.persistence.GeneratedValue;import javax.persistence.GenerationType;import javax.persistence.Id;import javax.persistence.MappedSuperclass;@MappedSuperclasspublic abstract class IdEntity {protected Long id;//这里的注解跟下面那个类的不统一,就会报错@Id@GeneratedValue(strategy = GenerationType.IDENTITY)@Column(name="id")public Long getId() {return id;}public void setId(Long id) {this.id = id;}}
Torganization.java
package com.bai.project.bean;import java.util.Date;import java.util.HashSet;import java.util.Set;import javax.persistence.CascadeType;import javax.persistence.Column;import javax.persistence.Entity;import javax.persistence.FetchType;import javax.persistence.JoinColumn;import javax.persistence.ManyToOne;import javax.persistence.OneToMany;import javax.persistence.Table;import javax.persistence.Temporal;import javax.persistence.TemporalType;//这里的注解全部都是注解在属性上的,上面那个类是注解在方法上的。就会报错,统一一下就不会报错了。@Entity@Table(name = "sys_organization")public class Torganization extends IdEntity implements java.io.Serializable {@Column(name="O_createdatetime")private Date createdatetime;@Column(name="O_name")private String name;@Column(name="O_address")private String address;@Column(name="O_code")private String code;@Column(name="O_icon")private String icon;@Column(name="O_seq")private Integer seq;@ManyToOne(targetEntity=Torganization.class,cascade=CascadeType.ALL)@JoinColumn(name="O_organization_ID")private Torganization organization;@OneToMany(targetEntity=Torganization.class,cascade=CascadeType.ALL,mappedBy="organization")private Set<Torganization> organizations = new HashSet<Torganization>(0);public Torganization() {super();}public Torganization(Date createdatetime, String name, String address, String code, String icon, Integer seq,Torganization organization, Set<Torganization> organizations) {super();this.createdatetime = createdatetime;this.name = name;this.address = address;this.code = code;this.icon = icon;this.seq = seq;this.organization = organization;this.organizations = organizations;}public Torganization getOrganization() {return organization;}public void setOrganization(Torganization organization) {this.organization = organization;}public Date getCreatedatetime() {return createdatetime;}public void setCreatedatetime(Date createdatetime) {this.createdatetime = createdatetime;}public String getName() {return this.name;}public void setName(String name) {this.name = name;}public String getAddress() {return this.address;}public void setAddress(String address) {this.address = address;}public String getCode() {return this.code;}public void setCode(String code) {this.code = code;}public String getIcon() {return icon;}public void setIcon(String icon) {this.icon = icon;}public Integer getSeq() {return this.seq;}public void setSeq(Integer seq) {this.seq = seq;}public Set<Torganization> getOrganizations() {return organizations;}public void setOrganizations(Set<Torganization> organizations) {this.organizations = organizations;}}
阅读全文
0 0
- 关联关系注解时报Could not determine type for错误的解决办法
- 实体类注解错误:Could not determine type for:
- 实体类注解错误:Could not determine type for: java.util.Set
- 实体类注解错误:Could not determine type for: java.util.Set
- 实体类注解错误:Could not determine type for: java.util.Set
- hibernate 实体类注解错误:Could not determine type for: com.xxx.entity.Site
- hibernate用注解 一对多 报Could not determine type for错误
- hibernate实体类注解错误Could not determine type for: java.util.Set
- 实体类注解错误:Could not determine type for: java.util.List
- 实体类注解错误:Could not determine type for: java.util.List
- Hibernate实体类注解错误- Could not determine type for: java.util.Set,at table:
- hibernate用注解 一对多 报Could not determine type for错误
- 使用Hibernate的UserType时报错:org.hibernate.MappingException: Could not determine type for: EMailList, at
- org.hibernate.MappingException: Could not determine type for 错误
- hibernate错误:Could not determine type for: java.util.Set
- 【java错误】Could not determine type for decimal
- Could not determine type for: decimal的解决方案
- 【Hibernate】Could not determine type for: String
- 一维数组传参
- centos7.2部署tomcat8全过程
- windows server下安装使用mosquitto
- TensorFlow中seq2seq库函数
- Elasticsearch学习--安装运行
- 关联关系注解时报Could not determine type for错误的解决办法
- 关于map的count和find的效率以及空类调用效率(一)
- c# T
- python3中,Tkinter中复选框(Checkbutton)的案例
- 数据结构学期总结
- mysql随机抓取记录
- Android Studio 3.0 The android gradle plugin version 3.0.0-alpha1 is too old, update to the
- Leetcode 12 integer-to-roman
- Leetcode:binary-tree-postorder-traversal