Announcement Announcement Module
Collapse
No announcement yet.
problem with sql query Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • problem with sql query

    Hi all, I just want to get rows from a Table using a JdbcCursorItemReader, but i have a problem with sql statement. I have this

    <bean id="gestionesItemReader" class="org.springframework.batch.item.database.Jdb cCursorItemReader">
    <property name="dataSource" ref="dataSource" />
    <property name="sql" value="select * from GESTIONES where estado=0 and tipogestion<>'DUP'"/>
    <property name="rowMapper">
    <bean id="gestionesMapper" class="org.springframework.jdbc.core.BeanPropertyR owMapper">
    <property name="mappedClass">
    <value type="java.lang.Class">com.Gestiones</value>
    </property>
    </bean>
    </property>
    </bean>

    The problem is i can't put "<>" symbol. How can i write the sql sentence?

    Thanks!!

  • #2
    Can you use "!=" instead of "<>"?

    Comment


    • #3
      I've just tried it but i get the following exception:

      Caused by: org.springframework.jdbc.BadSqlGrammarException: Executing query; bad SQL grammar [select * from GESTIONES where tipogestion!=DUP]; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: column name 'DUP' is not valid.

      Comment


      • #4
        Shouldn't it be

        select * from GESTIONES where tipogestion != 'DUP' ?

        (Notice the single quotes around DUP)

        Comment


        • #5
          That's right. Works fine, thank you!

          Comment


          • #6
            Forgot some code need to read it back...hehehe
            Reviewing is better than sleeping.. LOLZ

            List of afordable Condo's at chicago real estate listings
            Last edited by after; Jun 2nd, 2010, 09:24 AM.

            Comment

            Working...
            X