current <query-element> is defined as :
<xs:complexType name="query-element" mixed="true">
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="query-param"
type="query-param-element"/>
</xs:sequence>
<xs:attribute name="cache-mode"
type="cache-mode-attribute"/>
<xs:attribute name="cache-region" type="xs:string"/>
<xs:attribute name="cacheable" default="false"
type="xs:boolean"/>
<xs:attribute name="comment" type="xs:string"/>
<xs:attribute name="fetch-size" type="xs:int"/>
<xs:attribute name="flush-mode"
type="flush-mode-attribute"/>
<xs:attribute name="name" use="required"
type="xs:string"/>
<xs:attribute name="read-only" type="xs:boolean"/>
<xs:attribute name="timeout" type="xs:int"/>
</xs:complexType>
then the generated org.hibernate.internal.jaxb.mapping.hbm.JaxbQueryElement has a
_getContent()_ method for both String/Text and query-param attribute
* Objects of the following type(s) are allowed in the list
* {@link JAXBElement }{@code <}{@link JaxbQueryParamElement }{@code >}
* {@link String }
not very happy with this, it would be lot better to have a getQueryParam() and getValue()
so we don't need to check the instance type and do the cast everytime.
On Jul 6, 2012, at 8:44 PM, Hardy Ferentschik wrote:
Hi,
first up some info regarding the xsd. We initially auto generated it from our dtd and
then made some adjustments to resolve
some conflicts. The outcome is for sure less than optimal.
> I have two question about this xsd:
>
> 1. why we use xs:string for attributes such as timeout, batch-size, is there a
specific reason?
> I'm purposing this change
https://gist.github.com/3059390
I think it is just a result of the transformation. Changing it to xs:int seems reasonable
to me. There are probably
other cases we could improve.
> 2. we used to have this with the dtd, but I doubt if it is still possible with in the
current xsd. at least I could not find how to get this query text form
org.hibernate.internal.jaxb.mapping.hbm.JaxbSqlQueryElement
>
> not a xsd guy, can someone take a look?
>
>
> <sql-query name="orgNamesOnly">
> <return-scalar column="NAME" type="string"/>
> SELECT org.NAME FROM ORGANIZATION org
> </sql-query>
What do you get from JaxbSqlQueryElement#getContent. I could imagine that is is part of
it and you need to cast. Probably another spot where we need to do some manual changes.
--Hardy
-------------------------
Best Regards,
Strong Liu <stliu at hibernate.org>
http://about.me/stliu/bio