1
@Inject

private CollectionDatasource<Scheme, UUID> schemesDs;

我正在尝试为方案数据源实例化集合数据源

我在 Eclipse 上收到此错误作为错误

边界不匹配:Scheme 类型不是 CollectionDatasource 类型的有界参数 > 的有效替代品

这是 Scheme 的实体

@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;

}
}
4

1 回答 1

3

您的数据源字段应如下所示:

@Inject
private CollectionDatasource<Schema, Integer> schemasDs;

Scheme实体扩展了 BaseIntegerIdEntity ,因此它的主键类型是 Integer,而不是 UUID。

于 2016-04-01T05:12:14.417 回答