Why does Hibernate query have compile error in IntelliJ?

后端 未结 4 1485
栀梦
栀梦 2020-12-09 15:54

I have this Hibernate code:

Query q = session.createQuery(\"from MyTable where status = :status\");

It compiles and works fine..

4条回答
  •  情歌与酒
    2020-12-09 16:51

    IntelliJ is trying to validate your HQL query inside the string itself. To do this it needs to be configured to know about your hibernate configuration to ensure that a mapping exists for MyTable (it does at runtime, as you know - as it executes !).

    Check out the hibernate config section in intelliJ for your project.

    There is probably a way of turning it off if it is more hindrance than help.

提交回复
热议问题