PDA

View Full Version : Gird`s must is ModelKeyProvider, but I do not have such



animtor404
24 Nov 2014, 2:43 AM
I want to use Grid table for displaying data. But it demands unique key from my dto and I do not have such unique field.
How can I bypass that?

swetabansal
5 Jan 2015, 4:47 AM
I need to use composite key to set as ModelKeyProvider.

public class TpCompositeModelKeyProvider implements ModelKeyProvider<TransportationPricesDto> {


@Override
public String getKey(final TransportationPricesDto dto) {
// TODO make and return a String that represents the key for this object.


return String.valueOf(dto.getSymbol() + dto.getEffStartDate());
}
}

public interface TransportationPricesProperties extends PropertyAccess<TransportationPricesDto> {



TpCompositeModelKeyProvider getKey();

}