-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
in: repositoryRepositories abstractionRepositories abstractiontype: taskA general taskA general task
Milestone
Description
Jacopo Carravieri opened DATAJPA-824 and commented
When using a wrong query, that extracts only a portion of particular object
// Home contains other fields
@Query("SELECT home.id, home.address FROM Home")
List<Home> findAll();
The framework silently casts the result to List<Home>, but actually it turns out to be a List<Object[]>. As soon as a call to get() is made an exception is raised.
I would expect a ClassCastException or something similar thrown by the framework itself. I made some tests, it is possible to make such kind of casts only when the List is first instantiated without the template argument.
// No complain
List list = new ArrayList();
list.add(new Object());
return (List<Home>) list;
Affects: 1.9.1 (Gosling SR1)
Metadata
Metadata
Assignees
Labels
in: repositoryRepositories abstractionRepositories abstractiontype: taskA general taskA general task