Closed Ramblurr closed 7 years ago
Hello @Ramblurr,
Can you tell me which exact version of Spring Data
you are using?
Thanks @reda-alaoui.
I'm on the Ingalls-RELEASE
release train.
So this would be: spring-data-jpa 1.11.0.RELEASE
As mentioned in the doc, spring-data-jpa-entity-graph
versions follow spring-data
versions.
This means that spring-data-jpa-entity-graph
1.10.x is only expected to work with spring-data
1.10.y.
Therefore, you must use spring-data-jpa-entity-graph
1.11.x with spring-data-jpa 1.11.0.RELEASE
.
But there is currently no release for branch spring-data-jpa-entity-graph 1.11.x
.
I am going to perform it by the end of the day, so you can use it with spring-data-jpa 1.11.0.RELEASE
.
Thanks @reda-alaoui! I've checked out and compiled the master branch and now I have it working locally. Looking forward to the 1.11.x release.
Any plans to support Projections with the querydsl predicate methods?
I'd love to be able to return Projection DTOs, but querying with a Predicate and EG.
1.11.00 has just been released. It will be available in the next hour.
spring-data-jpa
projection query select part is built by scanning each attribute of the expected returned type.
i.e.:
public class Product {
private long id;
private String name;
private Brand brand;
}
public interface ProductName {
String getName();
}
public interface ProductRepository{
ProductName findProductNameByName(String name);
}
In this example, the following query would be built by spring-data-jpa
:
select name from product where name = $name
Therefore, I don't see what would be the interest of mixing projection DTOs with EntityGraphs.
I am closing this ticket to mark it as resolved, but feel free to explain what you would be expecting precisely :)
In JpaQueryCreator
:
if (returnedType.needsCustomConstruction()) {
List<Selection<?>> selections = new ArrayList<Selection<?>>();
for (String property : returnedType.getInputProperties()) {
PropertyPath path = PropertyPath.from(property, returnedType.getDomainType());
selections.add(toExpressionRecursively(root, path).alias(property));
}
query = query.multiselect(selections);
}
In the latest release 1.10.14
JpaEntityGraphRepositoryFactoryBean
is missing a constructor which is required due to theJpaRepositoryFactoryBean
base class.On the master branch it appears fixed, do you plan to release a fixed version soon?