Suppose I have 3 classes Rose
, Dandelion
& Tulip
. All of them are extending from the class Flowers
, which again extends the class Plant
.
And I have a DataJPA interface that extends from JpaRepository<???????>
, and has method save(Entity item)
.
Like this:
public class Rose extends Flower {
}
public class Dandelion extends Flower {
}
public class Tulip extends Flower {
}
public class Flower extends Plant {
}
public class Plant implements Persistable<Integer> {
}
public interface CrudFlowerRepository extends JpaRepository<?????????> {
int delete(int flowerId);
@Override
<rerurn object> save(S item);
How properly write CrudFlowerRepository
with generics when need object extends from Flower?
I try write CrudProductRepository<T, K extends TypedEntity>
and other variants like this <s extends Plant> save(S item);
. But my attempts failed.
Thank for advice.