执行编织(静态或动态)会导致以下错误:
Caused by: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.7.1.v20171221-bd47e8f): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [MyUnit] failed.
Internal Exception: java.lang.NullPointerException
at org.eclipse.persistence.exceptions.EntityManagerSetupException.predeployFailed(EntityManagerSetupException.java:231)
... 20 more
Caused by: java.lang.NullPointerException
at org.eclipse.persistence.sessions.Project.hasSQLResultSetMapping(Project.java:1040)
at org.eclipse.persistence.internal.jpa.metadata.queries.NamedNativeQueryMetadata.hasResultSetMapping(NamedNativeQueryMetadata.java:141)
at org.eclipse.persistence.internal.jpa.metadata.queries.NamedNativeQueryMetadata.process(NamedNativeQueryMetadata.java:172)
at org.eclipse.persistence.internal.jpa.metadata.MetadataProject.processQueries(MetadataProject.java:1713)
at org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor.addNamedQueries(MetadataProcessor.java:153)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:2024)
我没有使用EclipseLink 2.6.5获得此错误,如果我关闭Weaving,一切正常。 有办法解决它吗?是什么引发了错误?
答案 0 :(得分:1)
NPE是一个错误,因为它没有执行空检查并引发更具体的错误:只有在您的实体上指定了命名本机(SQL)查询时才会出现此错误引用了一个SqlResultSetMapping,但是你还没有定义任何结果集映射。有关文档和示例,请参阅https://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Basic_JPA_Development/Querying/Native#SQL_Result_Set_Mapping。