简体   繁体   English

JPA TopLink帮助!

[英]JPA TopLink Help!

Greetings, 问候,

As of now I had accomplished building a single-table JPA. 到目前为止,我已经完成了构建单表JPA的工作。 But when going to one-to-one or one-to-many. 但是当一对一或一对多时。 Things get complicated. 事情变得复杂。 Especially when it comes to queries with parameters. 特别是在涉及参数查询时。

I always get an exception on a named-query 我总是在命名查询中遇到异常

Exception Description: Error compiling the query [Subject.searchBySubjectCode: 
SELECT s FROM Subject s WHERE s.subjectcode = :subjectcode], line 1, column 33: 
unknown state or association field [subjectcode] of class [model.Subject].

How is this possible? 这怎么可能? Yet I added both entities on the persistence.xml. 但是我在persistence.xml上添加了两个实体。 BTW, I'm using TopLink Essentials and implement the JPA on MVC Architecture. 顺便说一句,我正在使用TopLink Essentials,并在MVC体系结构上实现JPA。 In addition, when I re-open the form, this exception always returns then. 另外,当我重新打开表单时,此异常总是返回。

java.lang.IllegalArgumentException: NamedQuery of name: <query> not found.

再次解决了问题...刚刚使用过TypedQuery

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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