[hibernate-dev] H4 mapping xsd question

Strong Liu stliu at hibernate.org
Mon Jul 16 07:21:37 EDT 2012


On Jul 10, 2012, at 10:04 PM, Steve Ebersole <steve at hibernate.org> wrote:

> If you can get JAXB to perform that binding for you great!  There are lots of places where we have this.

yes, I made it :D

https://github.com/stliu/hibernate-orm/commit/d57ffbdb32b8450599f30c9c28a4918ff9752802

https://github.com/stliu/hibernate-orm/commits/HHH-7450


> 
> Just to be clear, however, we cannot change the XSD to accomplish this in a way that means changes to end-user syntax.
> 
> On 07/10/2012 03:43 AM, Hardy Ferentschik wrote:
>> Type checking always sucks in this context. I also would try to minimize it as much as possible.
>> Provided your suggested change still allows to parse existing mapping documents I don't see why we should
>> not make our code easier to write.
>> 
>> --Hardy
>> 
>> On Jul 10, 2012, at 10:35 AM, Strong Liu wrote:
>> 
>>> 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.
>> 
>> _______________________________________________
>> hibernate-dev mailing list
>> hibernate-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/hibernate-dev
> 
> 
> 
> -- 
> steve at hibernate.org
> http://hibernate.org
> 

-------------------------
Best Regards,

Strong Liu <stliu at hibernate.org>
http://about.me/stliu/bio



More information about the hibernate-dev mailing list