You are not supposed to use the actual attribute name, you are supposed to
use bean syntax.
_name is a private attribute- so Castor will not be able to access it
directly.
In your case, the setter & getter for the _name attribute are setName &
getName.
By bean syntax, therefore, your object would have an attribute called
"name".
so your query syntax would be:
SELECT d from Product d where d.name = 'toto'

Don't remove "_" from the attribute- remove it from the query.
---
Sunil

---- Original Message ----
From: "Wlid Yemah" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 27, 2003 6:13 AM
Subject: [castor-dev] no solution to my pbm?

> Hi there,
>
> I have a class Product (see below) which is is mapped
> into a table Product in a SAP-DB database.
>
> When I execute this query:
>
> SELECT d from Product d where d._name = 'toto'
>
> I get an
>
> org.exolab.castor.jdo.oql.InvalidCharException
>
> I found out that this is because the attribute '_name'
> starts with '_'. If I remove the '_' to the attribute
> then the problem will not happen anymore and query
> executes well. But I can't
> remove the '_' because in fact my java classes are
> generated by Source Generator from Castor itself.
>
>
> Someone suggested to use " instead of ' ("toto"
> instead of 'toto') but that did not help because as I
> mentioned above the problem I have is related to the
> fact that the attribute '_name' starts with '_'.
>
> So, how to query on an attribute that starts with '_'?
> any workaround to this? thanks for any clue.
>
> public class Product
> {
>     private int       _id;
>     private String    _name;
> public int getId()
>         {
>              ...
>         }
>         public void setId( int anId )
>         {
>              ...
>         }
>
>         public String getName()
>         {
>              ...
>         }
>
>         public void setName( String aName )
>         {
>              ...
>         }
> }
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
> http://platinum.yahoo.com
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>         unsubscribe castor-dev



stay cool,
Spaceman Spiff

You imagine me sipping champagne from your boot
For taste of your elegant pride
I may be going to hell in a bucket, babe
But at least I'm enjoying the ride, at least I'll enjoy the ride.

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

Reply via email to