Hi Alex,

Castor do not support build in functions in mapping nor for return
columns. They can only be used in where and order clauses. The only
possibilities I can see are:

- use passthrough sql queries
- define a view (stored query) if sybase supports something like that
  instead of mapping your class to the table map it to the view
- add special getter/setter methods to your data object that
  provide similar function as the one you wanted to use in sql

Regards
Ralf


[EMAIL PROTECTED] schrieb:
> I have an object that I want to map to the column with build-in function:
> 
> select a, b, func(c) from object1
> 
> <class name="object1">
> :
>   <field name="a">
>     <sql name="a" ...>
>   </field>
>   <field name="b">
>     <sql name="b" ...>
>   </field>
> 
>  
>   <field name="c"
>     <sql name="func(c)" ...>
>   </field>
>   :
>   :
> </class>
> 
> I got the exception like:
> "Caused by: org.xml.sax.SAXException: unable to add attribute "c" to
> 'org.exolab.castor.mapping.xml.Sql' due to the following error:
> java.lang.IllegalStateException: "func(c)" is not a valid NMToken.
> 
> Is there a way to customize the query when retrieving objects from database?
> For example, the column might have some thing like "case when.....else
> .... end"
> in TRANSACT SQL.
> 
> I know I might be able to get the column c and do another direct sql
> query or
> something in getC() to processing the value. But doing direct sql query
> doesn't
> sound right to me.
> 
> Thanks!
> 
> Alex

-------------------------------------------------
If you wish to unsubscribe from this list, please 
send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to