You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 @NamedNativeQuery and @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).
First implementation approach was to use JPA's
Sort
API (use_sort_interface.patch.zip).
Problems arose:
Sort.by(s.titleEN)
raises an exception.s.titleEN as skillTitleEN
, but this does not work with constructor reference in SELECT clause.AchievableSkill
).@NamedNativeQuery
and@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)
The text was updated successfully, but these errors were encountered: