首页 新闻 会员 周边 捐助

//说我映射关系未关联一个位置的目标实体属性 可是我有啊???我晕 这什么情况

0
悬赏园豆:10 [已关闭问题] 关闭于 2013-11-20 10:19

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'baseDao': Autowiring of fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.orm.hibernate3.HibernateTemplate com.lesta.core.dao.impl.BaseDao.hibernateTemplate; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateTemplate' defined in class path resource [modules/spring.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [modules/spring.xml]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: com.lesta.Device1.model.Device.Direction in com.lesta.Device1.model.Direction.devices

//说我映射关系未关联一个位置的目标实体属性 可是我有啊???我晕 这什么情况

@Entity
@Table(name = "KC_DEVICE")
public class Device implements Serializable {

private String deviceid;// 设备编号
private MonitorArea monitorArea;// 监控点编号
private Direction direction;// 方向编号
private Way way;// 道路编号
private String devicecode;// 设备号码
private String ip;// 设备IP
private Integer maxspeed;// 最大速度
private Integer state;// 状态
private String devtypeid;// 设备类型编号
private String devtypecode;// 设备类型号码
private String father_deviceid;// 上级设备
private String td;
private String codeid;
private String type;// 设备类型
private String name;// 名称

@Id
@Column(name = "DEVICEID")
public String getDeviceid() {
return deviceid;
}

public void setDeviceid(String deviceid) {
this.deviceid = deviceid;
}

@ManyToOne
@JoinColumn(name = "MONITORID")
public MonitorArea getMonitorArea() {
return monitorArea;
}

public void setMonitorArea(MonitorArea monitorArea) {
this.monitorArea = monitorArea;
}

@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "DIRECTIONID")
public Direction getDirection() {
return direction;
}

public void setDirection(Direction direction) {
this.direction= direction;
}

@ManyToOne
@JoinColumn(name = "WAYID")
public Way getWay() {
return way;
}

public void setWay(Way way) {
this.way = way;
}

@Column(name = "DEVICECODE")
public String getDevicecode() {
return devicecode;
}

public void setDevicecode(String devicecode) {
this.devicecode = devicecode;
}

@Column(name = "IP")
public String getIp() {
return ip;
}

public void setIp(String ip) {
this.ip = ip;
}

@Column(name = "MAXSPEED")
public Integer getMaxspeed() {
return maxspeed;
}

public void setMaxspeed(Integer maxspeed) {
this.maxspeed = maxspeed;
}

@Column(name = "STATE")
public Integer getState() {
return state;
}

public void setState(Integer state) {
this.state = state;
}

@Column(name = "DEVTYPEID")
public String getDevtypeid() {
return devtypeid;
}

public void setDevtypeid(String devtypeid) {
this.devtypeid = devtypeid;
}

@Column(name = "DEVTYPECODE")
public String getDevtypecode() {
return devtypecode;
}

public void setDevtypecode(String devtypecode) {
this.devtypecode = devtypecode;
}

@Column(name = "FATHER_DEVICEID")
public String getFather_deviceid() {
return father_deviceid;
}

public void setFather_deviceid(String father_deviceid) {
this.father_deviceid = father_deviceid;
}

@Column(name = "TD")
public String getTd() {
return td;
}

public void setTd(String td) {
this.td = td;
}

@Column(name = "CODEID")
public String getCodeid() {
return codeid;
}

public void setCodeid(String codeid) {
this.codeid = codeid;
}

@Column(name = "TYPE")
public String getType() {
return type;
}

public void setType(String type) {
this.type = type;
}

@Column(name = "NAME")
public String getName() {
return name;
}

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

}

 

----------------------------------------------------

@Entity
@Table(name="SYS_CODE_FX")
public class Direction implements Serializable{

private String dmz;//卡口方向编号
private String dmsm1;//系统方向编号
private String dmsm2;//备注
private String dmsm3;//方向说明
private String dmsm4;


private Set<Device> devices;

@Id
@Column(name="DMZ")
public String getDmz() {
return dmz;
}
public void setDmz(String dmz) {
this.dmz = dmz;
}

@Column(name="DMSM1")
public String getDmsm1() {
return dmsm1;
}
public void setDmsm1(String dmsm1) {
this.dmsm1 = dmsm1;
}
@Column(name="DMSM2")
public String getDmsm2() {
return dmsm2;
}
public void setDmsm2(String dmsm2) {
this.dmsm2 = dmsm2;
}
@Column(name="DMSM3")
public String getDmsm3() {
return dmsm3;
}
public void setDmsm3(String dmsm3) {
this.dmsm3 = dmsm3;
}
@Column(name="DMSM4")
public String getDmsm4() {
return dmsm4;
}
public void setDmsm4(String dmsm4) {
this.dmsm4 = dmsm4;
}


@OneToMany(mappedBy="Direction")
public Set<Device> getDevices() {
return devices;
}
public void setDevices(Set<Device> devices) {
this.devices = devices;
}


}

询问java1的主页 询问java1 | 初学一级 | 园豆:72
提问于:2013-11-20 09:54
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册