public class GsonConverter implements PropertyConverter<List<SceneBulb>, String>{
@Override
public List<SceneBulb> convertToEntityProperty(String databaseValue) {
if(databaseValue == null) return null;
return new Gson().fromJson(databaseValue, new TypeToken<List<SceneBulb>>(){}.getType());
}
@Override
public String convertToDatabaseValue(List<SceneBulb> entityProperty) {
if(entityProperty == null) return null;
return new Gson().toJson(entityProperty);
}
}
@Convert(columnType = String.class, converter = GsonConverter.class)
private List<SceneBulb> devicelist;