Bound mismatch for Collectiondatasource

I am receiving this error on Eclipse as an error
Bound mismatch: The type Scheme is not a valid substitute for the bounded parameter <T extends Entity> of the type CollectionDatasource<T,K>
I have added this on the Screen controller
@Inject
private CollectionDatasource<Scheme, UUID> schemesDs;

Here is the Scheme Entity Class.

/*

  • Copyright © 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;
    }

}

Hi! You datasource field should look like this:


@Inject
private CollectionDatasource<Schema, Integer> schemasDs;

The Scheme entity extends BaseIntegerIdEntity, so its primary key type is Integer, not UUID.

Hi,

I have a non persistent entity:


@MetaClass(name = "league$LogEntry")
public class LogEntry extends AbstractNotPersistentEntity {
    private static final long serialVersionUID = 3388047637164968303L;

I want to link it to a datasource to store temporary data, how do I inject the data source as in the example above?

AbstractNotPersistentEntity has a key of UUID type, so the field should look like this:

@Inject
private CollectionDatasource<LogEntry, UUID> entriesDs;

Don’t forget to set “Do not refresh = true” and “Allow commit = false” for this datasource.

thanks…that works.