[
https://issues.apache.org/jira/browse/XMLBEANS-473?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13201651#comment-13201651
]
Jerry Sy commented on XMLBEANS-473:
-----------------------------------
Thanks Sunil.
Can you update the oracle bug with the same info so it can be tracked
internally as well? I will investigate this from the oracle bug first.
Thanks,
Jerry
> XML "dateTime" type issue with JDBC Control
> -------------------------------------------
>
> Key: XMLBEANS-473
> URL: https://issues.apache.org/jira/browse/XMLBEANS-473
> Project: XMLBeans
> Issue Type: Bug
> Components: XmlObject
> Affects Versions: Version 2.2
> Reporter: Sunil Polineni
> Labels: features
> Attachments: jdbcTestWorkspace.rar
>
>
> This issue happens when you define a database control method which SELECTs
> data and returns an XML Bean document. If one of the selected columns in your
> XML schema is of type "dateTime", then the XML text that is returned is
> missing the required "T" time separator character. Therefore, any subsequent
> attempts to call the getters on the resulting XML Bean document object (which
> normally should return java.util.Calendar objects) results in exceptions.
> @JdbcControl.SQL(statement="SELECT THE_ID as \"theId\", THE_DATE as
> \"theDate\" FROM JDBC_TEST WHERE THE_ID = {id}")
> XJdbcTestDocument runJdbcTest(String id) throws SQLException;
> XJdbcTestDocument is generated from the below xml file
> =========================================
> <schema
> xmlns="http://www.w3.org/2001/XMLSchema"
> targetNamespace="java:///JdbcTestXMLSchema"
> xmlns:tns="http://www.example.org/JdbcTestXMLSchema"
> elementFormDefault="qualified">
> <element name="XJdbcTest">
> <complexType>
> <choice maxOccurs="unbounded">
> <element name="XJdbcTestRow">
> <complexType>
> <sequence>
> <element name="theId" type="string" minOccurs="0"/>
> <element name="theDate" type="dateTime" minOccurs="0"
> nillable="true"/>
> </sequence>
> </complexType>
> </element>
> </choice>
> </complexType>
> </element>
> </schema>
> =============================================
> The <xml-fragment>1998-05-31 00:00:00.0</xml-fragment> is missing "T" it
> should be <xml-fragment>1998-05-31T00:00:00.0</xml-fragment> when this is
> being returned by a JDB Control and getting below exception
> javax.el.ELException:
> org.apache.xmlbeans.impl.values.XmlValueOutOfRangeException: Invalid date
> value: 1998-05-31 00:00:00.0
> at javax.el.BeanELResolver.getValue(BeanELResolver.java:266)
> at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143)
> at com.sun.el.parser.AstValue.getValue(AstValue.java:118)
> at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:192)
> at weblogic.servlet.jsp.ELHelper.evaluate(ELHelper.java:32)
> at jsp_servlet.__jdbcresults._jspService(__jdbcresults.java:205)
> I think When JDBC Control maps result set to XML, it by default uses SQL
> object's toString() method to convert from SQL object to String.
> To override/customize this behavior we can use ResultSetMapper
> http://beehive.apache.org/docs/1.0.1/system-controls/jdbc/apidocs/javadoc/org/apache/beehive/controls/system/jdbc/ResultSetMapper.html
> but this requires some good amount change in the code.
> Can you please advise whether if there is any other alternative?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]