[ 
https://issues.apache.org/jira/browse/XMLBEANS-473?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13201635#comment-13201635
 ] 

Sunil Polineni commented on XMLBEANS-473:
-----------------------------------------

1. Run the following statements on your own database instance:
CREATE TABLE JDBC_TEST
(
 THE_ID      VARCHAR2(30)           NOT NULL,
 THE_DATE      DATE                 NULL
);
insert into jdbc_test (the_id, the_date) values ('1234', sysdate);
insert into jdbc_test (the_id, the_date) values ('5678', null);

2. Create a data source on your own WebLogic server that references the 
database where you ran the above creation/inserts.

3. Modify my test code contained within the attached jdbcTestWorkspace.rar 
(\jdbcTest\jdbcTestApp\src\jdbcTestControl.java) to reference the data source 
name you created above rather than "cgDataSource".
@JdbcControl.ConnectionDataSource(jndiName = "<your-data-source-name")

4. Compile, deploy, and run my test code 
(\jdbcTest\jdbcTestApp\src\Controller.java).  Click on the various links 
defined on my index.jsp to observe the exceptions produced.  You can use either 
Oracle(BEA's) or Apache's JdbcControl using the import found within 
jdbcTestControl.java.  The same exceptions/bugs can be observed either way.

will upload the project
                
> 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
>
> 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: dev-unsubscr...@xmlbeans.apache.org
For additional commands, e-mail: dev-h...@xmlbeans.apache.org

Reply via email to