Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6411777

@Select("Select firstName,lastName from addresses where firstName = ?1 ")

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 6
    • core-libs
    • x86
    • windows_2000

      FULL PRODUCT VERSION :
      java version "1.6.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-beta-b59g)
      Java HotSpot(TM) Client VM (build 1.6.0-beta-b59g, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows 2000 [Version 5.00.2195]

      A DESCRIPTION OF THE PROBLEM :
      I am getting an exception when trying basic annotaions with the beta 6.0 driver.
      This is when using the "?1 ?2 ?3" etc parameter syntax.
       

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      compile three classes above, and run main method.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      It should printout rows that match parm.
      ACTUAL -
      exception


      ERROR MESSAGES/STACK TRACES THAT OCCUR :

      ***********************************
      java.sql.SQLRuntimeException: java.sql.SQLException: [SQL0104] Token 1 was not valid. Valid tokens: FOR WITH FETCH ORDER UNION EXCEPT OPTIMIZE.
      at com.sun.sql.QueryObjectGeneratorImpl.invoke(Unknown Source)
      at $Proxy0.getAllPeople(Unknown Source)
      at NavigateDataSet.main(NavigateDataSet.java:11)
      Caused by: java.sql.SQLException: [SQL0104] Token 1 was not valid. Valid tokens: FOR WITH FETCH ORDER UNION EXCEPT OPTIMIZE.
      at com.ibm.as400.access.JDError.throwSQLException(JDError.java:650)
      at com.ibm.as400.access.JDError.throwSQLException(JDError.java:621)
      at com.ibm.as400.access.AS400JDBCStatement.commonPrepare(AS400JDBCStatement.java:1481)
      at com.ibm.as400.access.AS400JDBCPreparedStatement.<init>(AS400JDBCPreparedStatement.java:194)
      at com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCConnection.java:1984)
      at com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCConnection.java:1926)
      at com.sun.sql.QueryObjectGeneratorImpl.getQueryImpl(Unknown Source)
      ... 3 more



      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
       

      public class Person {
          public String firstName;
          public String lastName;
          public String zip;
      }

      public interface PersonQueries extends BaseQuery {
             @Select("Select firstName,lastName from addresses where firstName = ?1 ")
          DataSet<Person> getAllPeople(String name);
          
      }


      public class NavigateDataSet{
          public static void main(String[] args){
              try{
                  Class.forName(outdriver);
                  Connection con = DriverManager.getConnection(...);
                  //Create a Query Object
                  PersonQueries qo = con.createQueryObject(PersonQueries.class);
                  //Execute our query
                  DataSet<Person> rows = qo.getAllPeople("paul");
                  //Now we can access each returned column
                  System.out.println("Display the rows");
                  for(Person person :rows)
                  {
                      System.out.println("Name:"+person.firstName+" "+ person.lastName);
                  }
                   
              }catch(Exception e){
                  e.printStackTrace();
              }
              System.exit(0);
          }
      }
      ---------- END SOURCE ----------

            rmandalasunw Ranjith Mandala (Inactive)
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: