JoinFetchType.INNER with spring data paging gives classcastexception [message #1620933] |
Tue, 17 February 2015 14:45 |
Jan Hoskens Messages: 2 Registered: February 2015 |
Junior Member |
|
|
Hi,
We're using Spring Data's method findAll(Pageable) in combination with the EclipseLink annotation @JoinFetch(JoinFetchType.INNER) but for some reason a class cast exception is triggered "DirectReadQuery cannot be cast to ObjectLevelReadQuery".
The entity is created as follows:
@Entity(name = "Company")
@TableGenerator(name = "COMPANY_ID", allocationSize = 1)
public class CompanyEntity {
@ElementCollection(targetClass = CompanyType.class, fetch = FetchType.EAGER)
@JoinFetch(JoinFetchType.INNER)
@Enumerated(EnumType.STRING)
@CollectionTable(name = "COMPANY_COMPANYTYPE")
@Column(name = "COMPANYTYPE", nullable = false)
private Set<CompanyType> companyTypes = new TreeSet<>();
}
which is used via Spring Data :
companyJpaRepository.findAll(new PageRequest(pageCriteria.getPageNumber(), pageCriteria.getPageSize(), new Sort(Direction.ASC, "name")))
Upon reading a page, the exception is thrown: (full trace in attachment)
java.lang.ClassCastException: org.eclipse.persistence.queries.DirectReadQuery cannot be cast to org.eclipse.persistence.queries.ObjectLevelReadQuery
Any ideas? Are we using the annotation in a wrong place or did we hit a bug? Normal data fetching without paging does seem to work fine.
EclipseLink version: 2.6.0-M3
Regards,
Jan
|
|
|
|
Powered by
FUDForum. Page generated in 0.03550 seconds