[ 
https://issues.apache.org/jira/browse/TUSCANY-1929?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12549483
 ] 

Amita Vadhavkar commented on TUSCANY-1929:
------------------------------------------

Based on the below comments, some reasons for getting the RuntimeException -

1) if the table has some rows where value of PK column has  null value,
please see if the query like - "select * from tablename where pkname is not 
null "- also gives same exception
or if the XMLHelper can print correct graph of all rows from table where pk 
does not have null value

2) if ConfigHelper.addPrimaryKey(columnName)  does not contain qualified 
columname. (this will result in another exception - java.lang.RuntimeException: 
Column CUSTID must be qualified with a table name and optional schema name
        at 
org.apache.tuscany.das.rdb.config.wrapper.QualifiedColumn.<init>(QualifiedColumn.java:51)
        at 
org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper.addPrimaryKey(MappingWrapper.java:348)
        at 
org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper.addPrimaryKey(MappingWrapper.java:334)
        at 
org.apache.tuscany.das.rdb.ConfigHelper.addPrimaryKey(ConfigHelper.java:81)
)

e.g. please see below - 
        ConfigHelper cfgHelper = new ConfigHelper();

       //below needs to be tableName.columnName or in case of multiple schema 
support turned ON, schemaName.tableName,columnName
        cfgHelper.addPrimaryKey("CUSTOMER.CUSTID"); 

        DAS das = DAS.FACTORY.createDAS(getConnection());
        Command select = das.createCommand("select CUSTID/* from customer");
        DataObject root = select.executeQuery();
        System.out.println(XMLHelper.INSTANCE.save(root, "root", "root"));

>From the description below, it looks like most probable cause is 1). In case 
>of 1) the reason for this exception is -
when the rows are fetched from db where some PK columns have null, conversion 
to SDO is not possible as 
uniqueness of SDO instances (one per row) can be guaranteed only with unique PK 
values.  

--------------------------------------------------------------------------------------------------------------------------------
when query does not include only pk , java.lang.RuntimeException is returned

i am trying to use das to read data from an access mdb into an dataobject (sdo)
DAS das = DAS.FACTORY.createDAS(con);
String sql = "select * from [" + tablename+ "] ;
Command readTableData = das.createCommand(sql);
DataObject root = readTableData.executeQuery();

when trying to run the code above, i get
Table WD Peripheral HD Controller in query does not include Primary Key column 
or has null value in it, can not proceed!

same error if i set the pk using ConfigHelper.addprimarykey(pk)
same error if the sql string contains all fields from the table, pk included

> generate xml from dataobject
> ----------------------------
>
>                 Key: TUSCANY-1929
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1929
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java DAS RDB
>    Affects Versions: Java-DAS-M2
>         Environment: java ee 1.5, eclipse 3.3.1.1. , windows xp, das 1.0 beta 
> 2, access mdb - no access installed, sca 1.0
>            Reporter: Kristina 
>            Assignee: Amita Vadhavkar
>         Attachments: XMLHelperSample.java
>
>
> hi all,
> not sure if this is a bug or is just me... bottom line i need help :)
> when trying to generate the xml from dataobject , i get an empty one 
> eventhough the dataobject is filled
> I am using: String generatedXml = XMLHelper.INSTANCE.save(root, 
> "http://helloworld2";, "MaterialListForTest"); where root is my dataobject
> what am i doing wrong?
> thanks,
> kristina

-- 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to