mappedBy reference an unknown target entity property错误

lzw 2016-11-03 10:39:16
package com.aj.footprint.model.po;

import java.io.Serializable;
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.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;


/**
* 菜单
*
*
*/
@Entity
@Table(name = "F_MENU")
public class TMenu implements Serializable{
private static final long serialVersionUID = 1L;

// Constructors

/** default constructor */
public TMenu() {
}

/** minimal constructor */
public TMenu(String mid, String fname) {
this.mid = mid;
this.fname = fname;
}

/** full constructor */
public TMenu(String mid, TMenu tmenu, String icon, String fname, Integer seq, String furl, Set<TMenu> tmenus,String roleids) {
this.mid = mid;
this.tmenu = tmenu;
this.icon = icon;
this.fname = fname;
this.seq = seq;
this.furl = furl;
this.tmenus = tmenus;
this.roleids=roleids;
}

/**
* ID
*/
private String mid;

/**
* 图标
*/
private String icon;

/**
* 名称
*/
private String fname;

/**
* 编号
*/
private Integer seq;

/**
* url
*/
private String furl;

/**
* 角色
*/
private String roleids;


private TMenu tmenu;

/**
* 下级列表
*/
private Set<TMenu> tmenus = new HashSet<TMenu>(0);

@Id
@Column(name = "ID" , length = 10)
@GeneratedValue(strategy = GenerationType.AUTO)
public String getMid() {
return mid;
}

public void setMid(String mid) {
this.mid = mid;
}

@Column(name = "ICON" , length = 50)
public String getIcon() {
return icon;
}

public void setIcon(String icon) {
this.icon = icon;
}

@Column(name = "FNAME" , length = 50)
public String getFname() {
return fname;
}

public void setFname(String fname) {
this.fname = fname;
}

@Column(name = "SEQ")
public Integer getSeq() {
return seq;
}

public void setSeq(Integer seq) {
this.seq = seq;
}

@Column(name = "FURL" , length = 200)
public String getFurl() {
return furl;
}

public void setFurl(String furl) {
this.furl = furl;
}

/* @Column(name = "BELONGTO" , length = 10)
public String getBelongto() {
return belongto;
}

public void setBelongto(String belongto) {
this.belongto = belongto;
}*/

@Column(name = "ROLEIDS" , length = 20)
public String getRoleids() {
return roleids;
}

public void setRoleids(String roleids) {
this.roleids = roleids;
}

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "BELONGTO")
public TMenu getTMenu() {
return tmenu;
}

public void setTMenu(TMenu tmenu) {
this.tmenu = tmenu;
}

@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "tmenu")
public Set<TMenu> getTmenus() {
return tmenus;
}

public void setTmenus(Set<TMenu> tmenus) {
this.tmenus = tmenus;
}



}

这是po类,为什么一直报:
Invocation of init method failed; nested exception is org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: com.aj.footprint.model.po.TMenu.tmenu in com.aj.footprint.model.po.TMenu.tmenus
...全文
276 回复 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

81,122

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧