使用 JPA 和 EclipseLink 从 Spring 个批处理表中读取数据
Read data from Spring batch tables using JPA and EclipseLink
我想使用 JPA 和 EclipseLink ORM 从 Spring 似乎不遵循 Eclipselink 约定的批处理表中读取数据
我收到如下异常:
Runtime Exceptions:
---------------------------------------------------------
java.lang.IllegalArgumentException: Column name BATCH_JOB_EXECUTION.CREATE_TIME does not follow DateTime type convention. Use suffix [_TS] due to conventions.
java.lang.NullPointerException
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:715) ~[org.eclipse.persistence.core-2.6.2.jar:na]
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:651) ~[org.eclipse.persistence.core-2.6.2.jar:na]
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:582) ~[org.eclipse.persistence.core-2.6.2.jar:na]
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:818) ~[org.eclipse.persistence.core-2.6.2.jar:na]
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:762) ~[org.eclipse.persistence.core-2.6.2.jar:na]
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:265) ~[org.eclipse.persistence.jpa-2.6.2.jar:na]
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:731) ~[org.eclipse.persistence.jpa-2.6.2.jar:na]
... 124 common frames omitted
日期时间字段存在问题,因为它们不包含 TS 作为后缀:
@Column(name = "CREATE_TIME")
private DateTime createTime;
是否有任何解决方法或如何关闭此类行为的方法?
我使用 java.util.Date 而不是 org.joda.time.DateTime 来解决问题,正如德米特里在问题下方的评论中所建议的
我想使用 JPA 和 EclipseLink ORM 从 Spring 似乎不遵循 Eclipselink 约定的批处理表中读取数据
我收到如下异常:
Runtime Exceptions:
---------------------------------------------------------
java.lang.IllegalArgumentException: Column name BATCH_JOB_EXECUTION.CREATE_TIME does not follow DateTime type convention. Use suffix [_TS] due to conventions.
java.lang.NullPointerException
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:715) ~[org.eclipse.persistence.core-2.6.2.jar:na]
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:651) ~[org.eclipse.persistence.core-2.6.2.jar:na]
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:582) ~[org.eclipse.persistence.core-2.6.2.jar:na]
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:818) ~[org.eclipse.persistence.core-2.6.2.jar:na]
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:762) ~[org.eclipse.persistence.core-2.6.2.jar:na]
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:265) ~[org.eclipse.persistence.jpa-2.6.2.jar:na]
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:731) ~[org.eclipse.persistence.jpa-2.6.2.jar:na]
... 124 common frames omitted
日期时间字段存在问题,因为它们不包含 TS 作为后缀:
@Column(name = "CREATE_TIME")
private DateTime createTime;
是否有任何解决方法或如何关闭此类行为的方法?
我使用 java.util.Date 而不是 org.joda.time.DateTime 来解决问题,正如德米特里在问题下方的评论中所建议的