Collectiondatasource 工作的绑定不匹配
Bound mismatch for Collectiondatasource working
@Inject
private CollectionDatasource<Scheme, UUID> schemesDs;
我正在尝试为方案数据源实例化集合数据源
我在 Eclipse 上收到这个错误
绑定不匹配:类型 Scheme 不是 CollectionDatasource 类型的绑定参数 > 的有效替代
这是方案的实体
@Inject
private CollectionDatasource<Scheme, UUID> schemesDs;
Here is the Scheme Entity Class.
/*
* Copyright (c) 2016 water-scheme-nigeria
*/
package com.company.waterschemenigeria.entity;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Column;
import com.haulmont.cuba.core.entity.BaseIntegerIdEntity;
import com.haulmont.chile.core.annotations.NamePattern;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
/**
* @author samuel.thampy
*/
@NamePattern("%s|locationName")
@Table(name = "WATERSCHEMENIGERIA_SCHEME")
@Entity(name = "waterschemenigeria$Scheme")
public class Scheme extends BaseIntegerIdEntity {
private static final long serialVersionUID = -5886267876250540580L;
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "LOCATION_NAME_ID")
protected Location locationName;
@Column(name = "WATERSCHEME", nullable = false)
protected String waterscheme;
@Column(name = "CAPACITY")
protected Double capacity;
@Column(name = "STATUS", nullable = false)
protected String status;
public void setLocationName(Location locationName) {
this.locationName = locationName;
}
public Location getLocationName() {
return locationName;
}
public void setWaterscheme(WaterScheme waterscheme) {
this.waterscheme = waterscheme == null ? null : waterscheme.getId();
}
public WaterScheme getWaterscheme() {
return waterscheme == null ? null : WaterScheme.fromId(waterscheme);
}
public void setStatus(Status status) {
this.status = status == null ? null : status.getId();
}
public Status getStatus() {
return status == null ? null : Status.fromId(status);
}
public void setCapacity(Double capacity) {
this.capacity = capacity;
}
public Double getCapacity() {
return capacity;
}
}
您的数据源字段应如下所示:
@Inject
private CollectionDatasource<Schema, Integer> schemasDs;
Scheme 实体扩展了 BaseIntegerIdEntity,所以它的主键类型是 Integer,而不是 UUID。
@Inject
private CollectionDatasource<Scheme, UUID> schemesDs;
我正在尝试为方案数据源实例化集合数据源
我在 Eclipse 上收到这个错误
绑定不匹配:类型 Scheme 不是 CollectionDatasource 类型的绑定参数 > 的有效替代
这是方案的实体
@Inject
private CollectionDatasource<Scheme, UUID> schemesDs;
Here is the Scheme Entity Class.
/*
* Copyright (c) 2016 water-scheme-nigeria
*/
package com.company.waterschemenigeria.entity;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Column;
import com.haulmont.cuba.core.entity.BaseIntegerIdEntity;
import com.haulmont.chile.core.annotations.NamePattern;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
/**
* @author samuel.thampy
*/
@NamePattern("%s|locationName")
@Table(name = "WATERSCHEMENIGERIA_SCHEME")
@Entity(name = "waterschemenigeria$Scheme")
public class Scheme extends BaseIntegerIdEntity {
private static final long serialVersionUID = -5886267876250540580L;
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "LOCATION_NAME_ID")
protected Location locationName;
@Column(name = "WATERSCHEME", nullable = false)
protected String waterscheme;
@Column(name = "CAPACITY")
protected Double capacity;
@Column(name = "STATUS", nullable = false)
protected String status;
public void setLocationName(Location locationName) {
this.locationName = locationName;
}
public Location getLocationName() {
return locationName;
}
public void setWaterscheme(WaterScheme waterscheme) {
this.waterscheme = waterscheme == null ? null : waterscheme.getId();
}
public WaterScheme getWaterscheme() {
return waterscheme == null ? null : WaterScheme.fromId(waterscheme);
}
public void setStatus(Status status) {
this.status = status == null ? null : status.getId();
}
public Status getStatus() {
return status == null ? null : Status.fromId(status);
}
public void setCapacity(Double capacity) {
this.capacity = capacity;
}
public Double getCapacity() {
return capacity;
}
}
您的数据源字段应如下所示:
@Inject
private CollectionDatasource<Schema, Integer> schemasDs;
Scheme 实体扩展了 BaseIntegerIdEntity,所以它的主键类型是 Integer,而不是 UUID。