-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
First implementation approach was to use JPA's Sort API (
use_sort_interface.patch.zip).
Problems arose:
- The column name to order by is due to the joining of two tables named "s.titleEN" or "s.titleDE". Using
Sort.by(s.titleEN)raises an exception. - Possible solution is to alias the name in the SELECT:
s.titleEN as skillTitleEN, but this does not work with constructor reference in SELECT clause. - I tried to remove the constructor reference bc JPA should be able to convert the JPATuples into the according VO via bean-instantiation and the return type of the repo metho. But this does not work bc the used VO is not an managed entity, due to the fact that we cross join two managed entities into an artifical entity (the VO
AchievableSkill). - I tried to "convince" JPA to map the JPATuples into this VO with
@NamedNativeQueryand@SqlResultSetMapping, but these annoations seem to work only on managed entities as target 🤪
Possible solution:
We do not use an autogenerated JPA repository and implement the repository completely by hand and generate the JPQL dynmically with JPA criteria API and convert the resuylt also by hand into the VO. Problem here: There are no tests for the repository (CustomAchievableSkillRepository) and only very view tests for the service (CustomAchievableSkillServiceImpl).
Originally posted by @Weltraumschaf in #107 (comment)