Tag Archives: selectByExample() Error

[Solved] There is no getter for property named ‘distinct’ in…

Cause Analysis:

The parameter passed by the selectByExample() method is wrong, the example type should be passed, not the entity class.

The error code is as follows:

@Override
    public PlantGrow selectPlantGrow(PlantGrow plantGrow1) {
        List<PlantGrow> plantGrows = plantGrowMapper.selectByExample(plantGrow1);
        if (!CollectionUtils.isEmpty(plantGrows)) {
            return plantGrows.get(0);
        }
        return null;
    }

Solution: Modify to select.