Hi Stefan,

I hope the following example helps.

CLASS:

public final class StringValue {
    private String _value;

    public StringValue() { }

    public String getValue() { return _value; }
    public void setValue(final String value) { _value = value; }
}


MAPPING:

<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN"
                           "http://castor.codehaus.org/mapping.dtd";>
<mapping>
    <class name="StringValue">
        <description>Determination of string values</description>
        <cache-type type="none"/>
        <map-to table="DUAL"/>
        <field name="value" type="string" identity="true">
            <sql name="VALUE" type="varchar"/>
        </field>
    </class>
</mapping>


QUERY:

CALL SQL
select MY_STRING_COLUMN as VALUE
from MY_TABLE
AS StringValue


COMMENT:

The table DUAL used at map-to tag is a dummy table at oracle but you
should be able to map to every other table name that needs not to be
present.

Regards
Ralf

Stefan Lober schrieb:
> Hello Ralf,
> 
> what would such a passthrough query look like in this
> case?
> 
> Thanks
> Stefan
> 
>  --- Ralf Joachim <[EMAIL PROTECTED]>
> schrieb: 
> 
>>Hi Stefan,
>>
>>the projection that you request is not possible with
>>castor OQL yet. I 
>>usually use passthrough queries for these situations
>>myself.
>>
>>Regards
>>Ralf
>>
>>
>>Stefan Lober schrieb:
>>
>>>Hello,
>>>
>>>I have a question about OQL queries:
>>>Is it possible to execute queries of the form
>>>select o.<FIELD1>.<FIELD2> ...
>>>i.e. where a field is requested that lies more
>>
>>than
>>
>>>one step deep into the object hierarchy?
>>>
>>>A concrete example:
>>>select flight.passenger.name from Flight as flight
>>>where flight.passenger.id < 100 and
>>
>>flight.plane.id =
>>
>>>2
>>>
>>>I tried to run code containing such a query
>>
>>execution.
>>
>>>The query.execute(...) can be done, but a
>>>NoSuchElementException occurs at the first call to
>>>queryResults.next(), saying "An exception was
>>
>>thrown
>>
>>>trying to access get methods to follow the path
>>>expression. java.lang.IllegalArgumentException:
>>
>>object
>>
>>>is not an instance of declaring class".
>>>
>>>Regards
>>>Stefan
>>>
>>>
>>>
>>>
>>>     
>>>             
>>>
>>
> ___________________________________________________________
> 
>>>Der frühe Vogel fängt den Wurm. Hier gelangen Sie
>>
>>zum neuen Yahoo! Mail: http://mail.yahoo.de
>>
>>>
> ---------------------------------------------------------------------
> 
>>>To unsubscribe from this list please visit:
>>>
>>>    http://xircles.codehaus.org/manage_email
>>
>>
> ---------------------------------------------------------------------
> 
>>To unsubscribe from this list please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>> 
> 
> 
> 
>               
> ___________________________________________________________ 
> Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
> 
>     http://xircles.codehaus.org/manage_email

-- 

Syscon Ingenieurbüro für
Meß- und Datentechnik GmbH
Ralf Joachim
Raiffeisenstraße 11
D-72127 Kusterdingen
Germany

Tel.   +49 7071 3690 52
Mobil: +49 173 9630135
Fax    +49 7071 3690 98

Email: [EMAIL PROTECTED]
Web:   www.syscon-informatics.de

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to