POJO注释没有被Kundera反映出来

时间:2013-05-04 20:52:01

标签: java annotations cassandra spring-batch

我正在编写一个简单的Spring Batch Application,它从文件中读取数据并将其写入Cassandra DB。

如果我在一个简单的java项目中运行Cassandra CRUD操作,只有一个下面的依赖项,我就能正常运行它。我可以成功执行CRUD操作。

依赖性:                      com.impetus.client             昆德拉,卡桑德拉             2.5         

现在问题来了!

我正在使用Spring Batch应用程序集成相同的代码。我最终会遇到以下异常:

10:22:19,816 DEBUG ThreadPoolTaskExecutor-1 dao.JdbcStepExecutionDao:203 - Truncating long message before update of StepExecution, original message is: org.springframework.batch.core.JobExecutionException: Partition handler returned an unsuccessful step
    at org.springframework.batch.core.partition.support.PartitionStep.doExecute(PartitionStep.java:110)
    at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:196)
    at org.springframework.batch.core.job.AbstractJob.handleStep(AbstractJob.java:375)
    at org.springframework.batch.core.job.flow.FlowJob.access$100(FlowJob.java:43)
    at org.springframework.batch.core.job.flow.FlowJob$JobFlowExecutor.executeStep(FlowJob.java:135)
    at org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:60)
    at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:144)
    at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:124)
    at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:103)
    at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:266)
    at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:118)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
; com.impetus.kundera.KunderaException: com.impetus.kundera.KunderaException: Entitymatadata should not be null
    at com.impetus.kundera.persistence.EntityManagerImpl.persist(EntityManagerImpl.java:174)
    at org.springframework.batch.admin.zipfeed.ZipLocationFeedWriter.write(ZipLocationFeedWriter.java:37)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)

现在我进一步比较了两个应用程序调试。看起来下面的注释在运行Spring Batch Application时没有反映出来。仅供参考,我提供了用于进行CRUD操作的bean。同一个bean适用于独立应用程序(jUnit)。

请让我知道如何让这个工作。看起来运行批处理应用程序时没有反映出注释。 (仅供参考,我已经拍摄了屏幕截图以便于理解)

   @Entity
   @Table(name = "ZipLookUp", schema = "ZipDB@cassandra_pu")
   public class ZipLocationBean {

          @Id
          @Column(name = "ZIP_CODE")
          private String zipcode;
          @Column(name = "CITY")
          private String city;
          @Column(name = "STATE")
          private String state;
          @Column(name = "COUNTRY")
          private String country;
          @Column(name = "LATITUDE")
          private double latitude;
          @Column(name = "LONGITUDE")
          private double longitude;
          // Getters and setters;
   }

1 个答案:

答案 0 :(得分:0)

请确认您是否:

<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" /> 在弹簧配置中存在。

-Vivek