define named query in orm.xml with jpa and hibernate

后端 未结 4 2017
既然无缘
既然无缘 2020-12-05 10:55

I\'m trying to put my named queries in my orm.xml (put in META-INF with persistence.xml) but my orm.xml seems to be ignored by hibernate/jpa.

When I try to create m

4条回答
  •  一向
    一向 (楼主)
    2020-12-05 11:26

    Your orm.xml has a minor error in it that breaks the whole thing. The point is that the sequence of elements' declarations should comply with the respective XML schema (which is http://java.sun.com/xml/ns/persistence/orm_1_0.xsd in particular). That is easy to check by running the xml code through a validator which honours xml schemas. Below is the corrected version of your orm.xml that must work as a charm.

    
    
    
        com.mysite