Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » JoinFetchType.INNER with spring data paging gives classcastexception
JoinFetchType.INNER with spring data paging gives classcastexception [message #1620933] Tue, 17 February 2015 14:45 Go to next message
Jan Hoskens is currently offline Jan HoskensFriend
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
Re: JoinFetchType.INNER with spring data paging gives classcastexception [message #1630540 is a reply to message #1620933] Mon, 23 February 2015 08:44 Go to previous message
Jan Hoskens is currently offline Jan HoskensFriend
Messages: 2
Registered: February 2015
Junior Member
Registered bug in EclipseLink with id 460570 to keep track of this.
Previous Topic:How to combine xml-inverse-reference with xml-element-ref for inhertance without xsi:type?
Next Topic:EclipseLink-6112 : Fetch group cannot be set on report query
Goto Forum:
  


Current Time: Thu Apr 25 16:12:31 GMT 2024

Powered by FUDForum. Page generated in 0.03326 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top