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 something 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
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 something 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

