临时类型IN javax.persistence(必须指定临时类型)

时间:2016-04-08 12:49:02

标签: java spring-mvc jpa eclipselink

我有这个RUNTIME异常问题(在关系数据库和Java容器中使用基于对象的关系持久性解决方案。)

Exception [EclipseLink-7212] (Eclipse Persistence Services - 2.4.2.v20130514-5956486): org.eclipse.persistence.exceptions.ValidationException
Exception Description: The attribute [submissionTime] from the entity class [class com.tdk.domain.Service] does not specify a temporal type. A temporal type must be specified for persistent fields or properties of type java.util.Date and java.util.Calendar.

但是,出于上帝的缘故,类型已经 java.util.Date !!!!

@Temporal(TemporalType.TIMESTAMP)
    @Column(name = "SUBMISSION_TIME")
    public Date getSubmissionTime() {
        return this.submissionTime;
    }

这里是完整的堆栈跟踪

Exception Description: The attribute [submissionTime] from the entity class [class com.tdk.domain.Service] does not specify a temporal type. A temporal type must be specified for persistent fields or properties of type java.util.Date and java.util.Calendar.
        at org.eclipse.persistence.exceptions.ValidationException.noTemporalTypeSpecified(ValidationException.java:1443)
        at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.MappingAccessor.processTemporal(MappingAccessor.java:1829)
        at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.MappingAccessor.processJPAConverters(MappingAccessor.java:1584)
        at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.MappingAccessor.processMappingConverter(MappingAccessor.java:1652)
        at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.MappingAccessor.processMappingValueConverter(MappingAccessor.java:1670)
        at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.BasicAccessor.process(BasicAccessor.java:414)
        at org.eclipse.persistence.internal.jpa.metadata.MetadataDescriptor.processMappingAccessors(MetadataDescriptor.java:1461)
        at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.ClassAccessor.processMappingAccessors(ClassAccessor.java:1526)
        at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.processMappingAccessors(EntityAccessor.java:1085)
        at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.process(EntityAccessor.java:645)
        at org.eclipse.persistence.internal.jpa.metadata.MetadataProject.processStage2(MetadataProject.java:1718)
        at org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor.processORMMetadata(MetadataProcessor.java:536)
        at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processORMetadata(PersistenceUnitProcessor.java:550)
        at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1484)
        at org.eclipse.persistence.jpa.PersistenceProvider.createContainerEntityManagerFactory(PersistenceProvider.java:235)
        at weblogic.persistence.BasePersistenceUnitInfo.initializeEntityManagerFactory(BasePersistenceUnitInfo.java:452)
        at weblogic.persistence.BasePersistenceUnitInfo.initializeEntityManagerFactory(BasePersistenceUnitInfo.java:445)
        at weblogic.persistence.BasePersistenceUnitInfo.init(BasePersistenceUnitInfo.java:119)
        at weblogic.persistence.BaseJPAIntegrationProvider.createPersistenceUnitInfo(BaseJPAIntegrationProvider.java:53)
        at weblogic.persistence.AbstractPersistenceUnitRegistry.storeDescriptors(AbstractPersistenceUnitRegistry.java:420)
        at weblogic.persistence.AbstractPersistenceUnitRegistry.loadPersistenceDescriptors(AbstractPersistenceUnitRegistry.java:127)
        at weblogic.persistence.ModulePersistenceUnitRegistry.<init>(ModulePersistenceUnitRegistry.java:61)
        at weblogic.servlet.internal.WebAppInternalModuleExtension$PersistenceExtension.setupPersistenceUnitRegistry(WebAppInternalModuleExtension.java:267)
        at weblogic.servlet.internal.WebAppInternalModuleExtension$PersistenceExtension.access$400(WebAppInternalModuleExtension.java:188)
        at weblogic.servlet.internal.WebAppInternalModuleExtension.prePrepare(WebAppInternalModuleExtension.java:58)
        at weblogic.application.internal.ExtensibleModuleWrapper$PrepareStateChange.next(ExtensibleModuleWrapper.java:293)
        at weblogic.application.internal.ExtensibleModuleWrapper$PrepareStateChange.next(ExtensibleModuleWrapper.java:285)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)
        at weblogic.application.internal.ExtensibleModuleWrapper.prepare(ExtensibleModuleWrapper.java:109)
        at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:100)
        at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleStateDriver.java:172)
        at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleStateDriver.java:167)
        at weblogic.application.utils.StateMachineDriver$ParallelChange.run(StateMachineDriver.java:80)
        at weblogic.work.ContextWrap.run(ContextWrap.java:40)
        at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:550)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:295)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:254)

2 个答案:

答案 0 :(得分:0)

我认为你应该删除length = 11

答案 1 :(得分:0)

@Chris评论是对的(列和时间注释是否被选中?将日志记录转为最佳或全部并检查EclipseLink在部署阶段所采用的内容。如果您在字段和属性上有注释,则只有一个集合将另外检查带有注释的类的版本是否是在运行时获取的版本 - 这不是多个版本的类第一次引起奇怪的运行时问题)