You have to execute:
SELECT d from Product d where d.name = 'toto'
d.name or d.dummy references the name you used in your mapping.xml.
<field name="name" type="String">
<sql name="nameInDb" type="char"/>
</field>
<field name="dummy" type="String">
<sql name="dummyInDb" />
</field>
Castor can not access the properties of your classes directly. It insteed calls
the getter and setter methods.
field name: dummy
property: _dummy <- castor do not take care of this properties name !!!!
getter: getDummy() { return _dummy; }
setter: setDummy(String dummy) { _dummy = dummy; }
----- Original Message -----
From: "Wlid Yemah" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 27, 2003 12:13 PM
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
>
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev