Assume that we have a persisted Entity object which has 10 variables, if I do for example repository.read(id)
or repository.findById(id)
I will get back an Entity object with every variable which is set from the repository.
Is there any way using JPAQuery or EntityManager or any other possible way, that I can make the call on the repository and get back the Entity object BUT without a specific variable being fetched as well?
I have tried the following, but it doesnt seem to do anything, still brings the Set within the response:
JPAQuery<Fruit> query = new JPAQuery<>(entityManager);
QFruit fruit = QFruit.Fruit;
Set<Apple> apple = new HashSet<Apple>();
query.select(fruit).from(fruit).where(fruit.id.eq(fruitId))
.createQuery().getParameters().remove(apple);
return query.fetchOne();