Hello!

I have a very strange behaviuor here: I try to get an object from the db which 
is named "Order". When I do a "select a from Order a" I got the Exception:

Exception: org.exolab.castor.jdo.oql.OQLSyntaxException: An incorrect token 
type was found near Order (found KEYWORD_ORDER, but expected IDENTIFIER)

The strange thing is that really nothing is wrong in my OQL. When copy/paste 
the whole handling of my object (mapping/data object class/OQL), the renamed 
copy works but the original does not. Why? It is not related to the order of 
execution.

If somebody is interessed I can send the whole sources including a JBuilder 7 
project file.

1) Mapping:

<mapping>
  <class name="Order" identity="id">
    <map-to table="rk100" />
    <field name="id" type="integer">
        <sql name="id" type="integer" />
    </field>
    <field name="aufnr" type="string">
        <sql name="aufnr" type="char" />
    </field>
  </class>

    <class name="Orderx" identity="id">
    <map-to table="rk100" />
    <field name="id" type="integer">
        <sql name="id" type="integer" />
    </field>
    <field name="aufnr" type="string">
        <sql name="aufnr" type="char" />
    </field>
  </class>
</mapping>

2) Data Object:

public class Order {
  private int id = 0;
  public int getId()                 {return id;}
  public void setId(int id)          {this.id = id;}

  private String aufnr = null;
  public String getAufnr()           {return aufnr;}
  public void setAufnr(String aufnr) {this.aufnr = aufnr;}
}

public class Orderx {
  private int id = 0;
  public int getId()                 {return id;}
  public void setId(int id)          {this.id = id;}

  private String aufnr = null;
  public String getAufnr()           {return aufnr;}
  public void setAufnr(String aufnr) {this.aufnr = aufnr;}
}

3) OQL:

      { // this works!
        Orderx order = null;
        OQLQuery oql = db.getOQLQuery("select a from Orderx a");
        QueryResults results = oql.execute();
        if (results.hasMore()) { // found!
          order = (Orderx) results.next();
          System.err.println("Orderx id= " + order.getId());
        }
      }

      { // this generates an exception
        Order order = null;
        OQLQuery oql = db.getOQLQuery("select a from Order a");
        QueryResults results = oql.execute();
        if (results.hasMore()) { // found!
          order = (Order) results.next();
          System.err.println("Order id= " + order.getId());
        }
      }


-- 
Dipl. Inform. Boris Klug, control IT GmbH, Germany

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to