"поле jdoFieldFlags конфликтует" при использовании @MappedSuperclass в GAE/J & JPA
Я получил ошибку при запросе к объекту, расширенному с помощью mappedsuperclass в GAE / J.
MappedSuperClass
import java.sql.Timestamp;
import javax.persistence.MappedSuperclass;
@MappedSuperclass
public abstract class AbstractModel {
private String lastModifiedBy;
private Timestamp createTimestamp;
private Timestamp modifyTimestamp;
private Integer version;
// setters & getters
}
сущность
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name = "EMPLOYEE")
public class EmployeeModel extends AbstractModel {
@Id
private Integer id;
private String address;
private String name;
private String position;
// setters & getters
}
JPA запрос, как показано ниже.
Query q = em.createNativeQuery("SELECT * FROM EMPLOYEE", EmployeeModel.class);
@SuppressWarnings("unchecked")
List<EmployeeModel> list = q.getResultList();
И я получил ошибку
javax.persistence.PersistenceException: Result Class query field names are not case sensitive. It does not allow fields with same name, but in a different case. For instance, the field "jdoFieldFlags" is conflicting.
at org.datanucleus.api.jpa.NucleusJPAHelper.getJPAExceptionForNucleusException(NucleusJPAHelper.java:302)
at org.datanucleus.api.jpa.JPAQuery.getResultList(JPAQuery.java:202)
at test20140919.EmployeeDao.list(EmployeeDao.java:21)
at test20140919.EmployeeLogic.list(EmployeeLogic.java:34)
at test20140919.EmployeeAction.list(EmployeeAction.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:115)
at com.google.api.server.spi.SystemService.invokeServiceMethod(SystemService.java:359)
at com.google.api.server.spi.SystemServiceServlet.execute(SystemServiceServlet.java:160)
at com.google.api.server.spi.SystemServiceServlet.doPost(SystemServiceServlet.java:118)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
at com.google.appengine.api.socket.dev.DevSocketFilter.doFilter(DevSocketFilter.java:74)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.tools.development.ResponseRewriterFilter.doFilter(ResponseRewriterFilter.java:127)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:34)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:63)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:125)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectRequest(DevAppServerModulesFilter.java:366)
at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectModuleRequest(DevAppServerModulesFilter.java:349)
at com.google.appengine.tools.development.DevAppServerModulesFilter.doFilter(DevAppServerModulesFilter.java:116)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
at com.google.appengine.tools.development.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:98)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:491)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:938)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Caused by: org.datanucleus.exceptions.NucleusUserException: Result Class query field names are not case sensitive. It does not allow fields with same name, but in a different case. For instance, the field "jdoFieldFlags" is conflicting.
at org.datanucleus.store.rdbms.query.ResultClassROF.populateDeclaredFieldsForUserType(ResultClassROF.java:508)
at org.datanucleus.store.rdbms.query.ResultClassROF.populateDeclaredFieldsForUserType(ResultClassROF.java:514)
at org.datanucleus.store.rdbms.query.ResultClassROF.access$100(ResultClassROF.java:65)
at org.datanucleus.store.rdbms.query.ResultClassROF$1.run(ResultClassROF.java:228)
at java.security.AccessController.doPrivileged(Native Method)
at org.datanucleus.store.rdbms.query.ResultClassROF.<init>(ResultClassROF.java:224)
at org.datanucleus.store.rdbms.query.RDBMSQueryUtils.getResultObjectFactoryForNoCandidateClass(RDBMSQueryUtils.java:532)
at org.datanucleus.store.rdbms.query.SQLQuery.performExecute(SQLQuery.java:295)
at org.datanucleus.store.query.Query.executeQuery(Query.java:1789)
at org.datanucleus.store.query.AbstractSQLQuery.executeWithMap(AbstractSQLQuery.java:345)
at org.datanucleus.api.jpa.JPAQuery.getResultList(JPAQuery.java:185)
... 48 more
В сообщении говорится, что "поле jdoFieldFlags является конфликтующим.", Но любые поля не дублируются, и я не определяю поле jdoFieldFlags.
Почему эта ошибка происходит? и, пожалуйста, скажите мне, как решить эту ошибку.
Определение всех полей в EmployeeModel и не расширение AbstractModel может устранить эту ошибку. Но я хочу избежать этого решения, потому что поля в AbstractModel являются общими для всех таблиц в моем приложении.
[Обновление] Версия App Engine 1.9.11, а хранилище - cloudSQL. Таблица определена ниже.
CREATE TABLE `EMPLOYEE` (
`address` varchar(50) NOT NULL,
`name` varchar(50) NOT NULL,
`position` varchar(45) DEFAULT NULL,
`id` int(11) NOT NULL,
`lastModifiedBy` varchar(45) NOT NULL,
`createTimestamp` datetime NOT NULL,
`modifyTimestamp` datetime NOT NULL,
`version` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
[Update2] Я обновил DataNucleus до версии 4.0.2, но произошла похожая ошибка. У меня нет дубликатов полей и dnFieldFlags.
javax.persistence.PersistenceException: Result Class query field names are not case sensitive. It does not allow fields with same name, but in a different case. For instance, the field "dnFieldFlags" is conflicting.
at org.datanucleus.api.jpa.NucleusJPAHelper.getJPAExceptionForNucleusException(NucleusJPAHelper.java:308)
at org.datanucleus.api.jpa.JPAQuery.getResultList(JPAQuery.java:213)
at (my app : List<class with inheritance> list = q.getResultList();)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:115)
at com.google.api.server.spi.SystemService.invokeServiceMethod(SystemService.java:359)
at com.google.api.server.spi.SystemServiceServlet.execute(SystemServiceServlet.java:160)
at com.google.api.server.spi.SystemServiceServlet.doPost(SystemServiceServlet.java:118)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
at com.google.appengine.api.socket.dev.DevSocketFilter.doFilter(DevSocketFilter.java:74)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.tools.development.ResponseRewriterFilter.doFilter(ResponseRewriterFilter.java:127)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:34)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:63)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:125)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectRequest(DevAppServerModulesFilter.java:366)
at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectModuleRequest(DevAppServerModulesFilter.java:349)
at com.google.appengine.tools.development.DevAppServerModulesFilter.doFilter(DevAppServerModulesFilter.java:116)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
at com.google.appengine.tools.development.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:98)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:491)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:938)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Caused by: org.datanucleus.exceptions.NucleusUserException: Result Class query field names are not case sensitive. It does not allow fields with same name, but in a different case. For instance, the field "dnFieldFlags" is conflicting.
at org.datanucleus.store.rdbms.query.ResultClassROF.populateDeclaredFieldsForUserType(ResultClassROF.java:507)
at org.datanucleus.store.rdbms.query.ResultClassROF.populateDeclaredFieldsForUserType(ResultClassROF.java:512)
at org.datanucleus.store.rdbms.query.ResultClassROF.access$100(ResultClassROF.java:65)
at org.datanucleus.store.rdbms.query.ResultClassROF$1.run(ResultClassROF.java:225)
at java.security.AccessController.doPrivileged(Native Method)
at org.datanucleus.store.rdbms.query.ResultClassROF.<init>(ResultClassROF.java:221)
at org.datanucleus.store.rdbms.query.RDBMSQueryUtils.getResultObjectFactoryForNoCandidateClass(RDBMSQueryUtils.java:547)
at org.datanucleus.store.rdbms.query.SQLQuery.performExecute(SQLQuery.java:289)
at org.datanucleus.store.query.Query.executeQuery(Query.java:1840)
at org.datanucleus.store.query.AbstractSQLQuery.executeWithMap(AbstractSQLQuery.java:356)
at org.datanucleus.api.jpa.JPAQuery.getResultList(JPAQuery.java:197)
... 48 more