You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Luciano Resende (JIRA)" <tu...@ws.apache.org> on 2007/07/14 19:59:04 UTC

[jira] Resolved: (TUSCANY-1434) DAS.applyChanges() does not initialize database connection if needed

     [ https://issues.apache.org/jira/browse/TUSCANY-1434?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Luciano Resende resolved TUSCANY-1434.
--------------------------------------

       Resolution: Fixed
    Fix Version/s: Java-DAS-Next

Suggested fix applied.

> DAS.applyChanges() does not initialize database connection if needed
> --------------------------------------------------------------------
>
>                 Key: TUSCANY-1434
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1434
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java DAS RDB
>    Affects Versions: Java-DAS-beta1
>            Reporter: Ron Gavlin
>             Fix For: Java-DAS-Next
>
>
> I am attempting to use das.applyChanges() to insert a row into the CUSTOMER table. My augmented "basicCustomerMappingWithCUD2.xml" file includes a "ConnectionInfo" element with a "datasource" attribute specified. Note below that I am using static SDO without invoking the standard priming das.getCommand("command").executeQuery() before invoking das.applyChanges(). When I execute the following code snippet, I receive an error in das.applyChanges() that there is no database connection currently open.
>         DAS das = DAS.FACTORY.createDAS(getConfig("basicCustomerMappingWithCUD2.xml"));
>         DataGraph dg = SDOUtil.createDataGraph();
>         dg.getChangeSummary().beginLogging();
>         dg.createRootObject(TypeHelper.INSTANCE.getType(Customers.class));
>         Customers customers = (Customers) dg.getRootObject();
>         Customer customer = CustomerFactory.INSTANCE.createCustomer();
>         customer.setID(9999);
>         customer.setLASTNAME("Jones");
>         customers.getCustomer().add(customer);
>         // FIXME the following line is required to workaround this DAS bug  
>         // whereby no connection exists w/out a priming getCommand().executeQuery()
>         // Note that the following line should be removed in this test code after the patch for this bug is applied
>         ((DASImpl) das).getConnection();
>         // end of FIXME
>       
>         das.applyChanges((DataObject) customers);
> The proposed patch for this bug is as follows:
> org.apache.tuscany.das.rdb.impl.DASImpl.class
> Change line 114 FROM
> Line 107
>     /*
>      * (non-Javadoc)
>      * 
>      * @see org.apache.tuscany.das.rdb.CommandGroup#getApplyChangesCommand()
>      */
>     public ApplyChangesCommandImpl getApplyChangesCommand() {
>         ApplyChangesCommandImpl cmd = new ApplyChangesCommandImpl(configWrapper, connection); // Line 114
>         return cmd;
>     }
> TO
> Line 107
>     /*
>      * (non-Javadoc)
>      * 
>      * @see org.apache.tuscany.das.rdb.CommandGroup#getApplyChangesCommand()
>      */
>     public ApplyChangesCommandImpl getApplyChangesCommand() {
>         ApplyChangesCommandImpl cmd = new ApplyChangesCommandImpl(configWrapper, getConnection()); //Line 114
>         return cmd;
>     }
> FYI, the customer.xsd for this test was augmented to include the "Customers" complex type as follows:
> <xsd:complexType name="Customers">
>        <xsd:sequence>
>           <xsd:element name="customer" type="Customer" maxOccurs="unbounded" />
>        </xsd:sequence>
> </xsd:complexType>
> Let me know if you have questions.
> - Ron

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org