HQL with parameters NoSuchMethodError

后端 未结 4 1890
旧巷少年郎
旧巷少年郎 2021-01-13 08:45

I am sure I am overlooking something obvious

the following static query works fine

hqlQuery = \"select user from User as user where user.id = \'useri         


        
相关标签:
4条回答
  • 2021-01-13 08:50

    Try add this dependency in your pom.xml:

        <dependency>
            <groupId>antlr</groupId>
            <artifactId>antlr</artifactId>
            <version>2.7.7</version>
        </dependency>
    
    0 讨论(0)
  • 2021-01-13 08:51

    You can this:

    <dependency>
        <groupId>org.apache.struts</groupId>
        <artifactId>struts-core</artifactId>
        <version>1.3.10</version>
    
        <exclusions>
            <exclusion>
                <groupId>antlr</groupId>
                <artifactId>antlr</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    
    0 讨论(0)
  • 2021-01-13 08:52

    Problem here is there is a conflict between the two ANT jar files(namely: antlr-2.7.6.jar from Hibernate Jar library & antlr-2.7.2 from struts-1.3) in your project. This appears to be a peculiar problem with Struts-1.3 & Hibernate applications.

    Please remove antlr-2.7.2.jar from your project(/WEB-INF/lib folder)& it should work fine.. Let me know if it works..

    0 讨论(0)
  • 2021-01-13 09:02

    Looks like you mixed incompatible versions of Hibernate jars (probably ANTLR jar has a wrong version).

    0 讨论(0)
提交回复
热议问题