使用JPA和EclipseLink

时间:2016-07-25 13:49:56

标签: jpa eclipselink spring-batch

我想从Spring批处理表中使用JPA和EclipseLink ORM读取数据,这些表似乎不遵循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;

是否有任何解决方法或如何关闭此类行为?

1 个答案:

答案 0 :(得分:0)

我使用java.util.Date而不是org.joda.time.DateTime来解决Dmitry在问题下面的评论中提出的问题