Hi Konstantin,
Thanks for the reply!
No, I am using the DataManager, does this only work with the EntityManager? I will add the original code below, although it contains German words in the query.
If I remember correctly, I debugged into it and at some point the query was enhanced with somthing like “addWhereClause” because we have a row level constraint and in doing so, the query got analzed by a JPA parser into a tree, the NEW expression was reognized and handled and after that, the modified query was returned from a transformer and there the error was present.
If needed, I can take some notes of the classes involved but I have to change some code again for that.
As a workaround, I am using “loadValues” now and create my object from that, that might be a tiny bit more overhead than using NEW directly but it works.
Thanks in advance for any hints!
List<MnkpKontrolle> kontrollen = dataManager.load(MnkpKontrolle.class)
.query("SELECT NEW de.balvi.ipi.lm.statistik.mnkp.domain.MnkpKontrolle(mnkpBetrieb.statistik, mnkpBetrieb, kontrolle)" +
" from lm_Kontrolle kontrolle" +
" join lm_MnkpBetrieb mnkpBetrieb on mnkpBetrieb.betriebsstaette = kontrolle.betriebsstaette" +
" where mnkpBetrieb.statistik = :statistik" +
" and kontrolle.kontrolldatum >= :von and kontrolle.kontrolldatum <= :bis" +
" and (kontrolle.kontrollart = 'PLANKONTROLLE'"+
" or mnkpBetrieb.katAvvBetriebsart member of kontrolle.katKontrollierteBetriebsarten)"
)
.parameter("statistik", kopfdaten)
.parameter("von", kopfdaten.getZeitraumVon())
.parameter("bis", kopfdaten.getZeitraumBis())
.list();