Announcement Announcement Module
Collapse
No announcement yet.
Extract Data from Domain Object using a RowMapper in the Processor Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Extract Data from Domain Object using a RowMapper in the Processor

    I m using JdbcCursorItemReader to read data from Database. As JdbcCursorItemReader requires a rowMapper I have a CustomRowMapper in place, I m populating my domain object/pojo object at the sametime in the CustomRowMapper class.

    public class RTIDataRowMapper implements RowMapper<RTIEarningsData>
    {

    RTIData rtData= new RTIData();
    rtData.setShowDate(rs.getDate("show_date").getTime ()));
    rtData.setShowName(rs.getString("show_name"));
    }

    RTIData is my domain/Pojo object which has getters & setters.

    I want to access my domain object i.e. rtData in the Processor class.

    public class CustomProcessor implements ItemProcessor<RTIData,Task>
    {

    @Override
    public Taskprocess(RTIData rtData) throws Exception
    {
    // TODO Auto-generated method stub
    boolean isConditionalityChangedVar = isConditionalityChanged(rtData);

    if(isConditionalityChangedVar)
    {
    Task tTask = convertToTask(rtData);
    return tTask;
    }
    else
    {
    return null;
    }
    }

    But I m not able to get the same instance of the rtData which I have populated in my CustomRowMapper class. Since there's a contraint I cannot connect to database using DAO in processor I will have to use the domain object populated in CustomRowMapper. Do I have to do any configuration changes or set it using setMapper. Please guide me with some code snippet. Thanks

  • #2
    right now its hard to understand what you really want to archieve

    Code:
    public class RTIDataRowMapper implements RowMapper<RTIEarningsData>
    {
    
    RTIData rtData= new RTIData();
    rtData.setShowDate(rs.getDate("show_date").getTime ()));
    rtData.setShowName(rs.getString("show_name"));
    // has to return RTIEarningsData, see implements
    
    returns RTIEarningsData
    }
    so there is no RTIData Object coming from the RowMapper, at least not in your code example

    Comment


    • #3
      Originally posted by pooh View Post
      I m using JdbcCursorItemReader to read data from Database. As JdbcCursorItemReader requires a rowMapper I have a CustomRowMapper in place, I m populating my domain object/pojo object at the sametime in the CustomRowMapper class.

      public class RTIDataRowMapper implements RowMapper<RTIData>
      {

      RTIData rtData= new RTIData();
      rtData.setShowDate(rs.getDate("show_date").getTime ()));
      rtData.setShowName(rs.getString("show_name"));
      }

      RTIData is my domain/Pojo object which has getters & setters.

      I want to access my domain object i.e. rtData in the Processor class.

      public class CustomProcessor implements ItemProcessor<RTIData,Task>
      {

      @Override
      public Taskprocess(RTIData rtData) throws Exception
      {
      // TODO Auto-generated method stub
      boolean isConditionalityChangedVar = isConditionalityChanged(rtData);

      if(isConditionalityChangedVar)
      {
      Task tTask = convertToTask(rtData);
      return tTask;
      }
      else
      {
      return null;
      }
      }

      But I m not able to get the same instance of the rtData which I have populated in my CustomRowMapper class. Since there's a contraint I cannot connect to database using DAO in processor I will have to use the domain object populated in CustomRowMapper. Do I have to do any configuration changes or set it using setMapper. Please guide me with some code snippet. Thanks

      That was a typing mistake. Sorry.

      Comment


      • #4
        ok then its still a bit hard to see whats the goal here

        But I m not able to get the same instance of the rtData which I have populated in my CustomRowMapper class
        it should be the same instance, can you explain a bit more detailed what the methods isConditionalityChanged(rtData); and convertToTask(rtData); do ?

        Comment


        • #5
          I tried to debug my code & I did find the same instance. These methods isConditionalityChanged(rtData); and convertToTask(rtData); have business logic. I was able to solve this problem. Thanks for your help Michael.

          Comment

          Working...
          X