Announcement Announcement Module
Collapse
No announcement yet.
deletion while polling with null value in field Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • deletion while polling with null value in field

    Code :
    <code><int-jdbc:inbound-channel-adapter
    query="SELECT USER_ID,BOOK_ID FROM BOOK WHERE ROWNUM &lt;= 11"
    channel="index-back-data" data-source="dataSource"
    max-rows-per-poll="10"
    update=" ? "
    row-mapper="DataRowMapper">
    <intoller fixed-delay="10000" />
    </int-jdbc:inbound-channel-adapter>
    </code>

    problem :

    while polling over the BOOK table i might get bookid as null so how to delete it using the update property?

    can we use conditional delete in update as :bookId != null ? 'DELETE FROM BOOK WHERE USER_ID = :userId AND BOOK_ID = :bookId : DELETE FROM BOOK WHERE USER_ID = :userId AND BOOK_ID IS NULL

    any help will be greatly appreciated !

  • #2
    Hello!
    can we use conditional delete in update
    No, it strictly should be a valid DML expression.

    you have to add update-per-row="true"

    If you are using Oracle you can use like this:
    HTML Code:
    <int-jdbc:inbound-channel-adapter
    query="SELECT ROWID row_id, USER_ID,BOOK_ID FROM BOOK WHERE ROWNUM &lt;= 11"
    channel="index-back-data" data-source="dataSource"
    max-rows-per-poll="10"
    update-per-row="true"
    update="DELETE FROM BOOK WHERE ROWID = :row_id"
    row-mapper="DataRowMapper">
    <intoller fixed-delay="10000" />
    </int-jdbc:inbound-channel-adapter>
    From other side: doesn't it really work 'DELETE FROM BOOK WHERE USER_ID = :userId AND BOOK_ID = :bookId' despite the fact that 'bookId = null' ?
    Have you tried it in the forehead?

    Take care,
    Artem

    Comment

    Working...
    X