gpt4 book ai didi

java - 时间类型 IN javax.persistence (必须指定时间类型)

转载 作者:太空宇宙 更新时间:2023-11-04 12:44:15 25 4
gpt4 key购买 nike

我遇到了这个运行时异常问题(在关系数据库和 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)

最佳答案

我认为你应该删除 length = 11

关于java - 时间类型 IN javax.persistence (必须指定时间类型),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36499970/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com