简体   繁体   中英

JPQL (HQL) use parameter of type Map in query

I have a HashMap<String, Float> paramMap

Where the key is the id of entity Invoice and the value is some calculation.

JPA allowes this map to be set as a parameter with name "paramMap".

Is it possible to use the map in the jpql(hql) in the following manner? (the query is simplified for the example but it captures the esence of my inquery)

SELECT Invoice.id as key, :paramMap[Invoice.id] as value from Invoice Invoice

Is it possible to use a map in JPQL (HQL) in the following manner?

No, it's not possible.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM