ADF BC's readXml doesn't work with one-to-one links

I’m currently having some problems with 1-to-1 links in bc4j. Using readXml to read data into view linked with a 1-to-1 view link doesn’t seem to work. It could be related to a problem Steve muench wrote about some time ago: ClassCastException Accessing One-To-Many Entity View Link Accessor (Bug 4113607).

I’ve created two views, Tab1View and Tab2View, and they’re linked using a 1-to-1 view link. Now i want to read the following xml document into these views:

<tab1view>
  <tab1viewrow>
    <name>some name</name>
    <tab2view>
      <tab2viewrow>
        <name>another name</name>
      </tab2viewrow>
    </tab2view>
  </tab1viewrow>
</tab1view>

Using the following code:

ViewObject tab1View = service.findViewObject("Tab1View");
DOMParser xmlParser = new DOMParser(); // Create a new XML Parser
xmlParser.parse(this.getClass().getClassLoader()
   .getResourceAsStream("bc4jtest/Data.xml"));
Element element = xmlParser.getDocument().getDocumentElement();
tab1View.readXML(element, -1);

If i run this code the following error message is displayed:

oracle.jbo.ReadXMLException: JBO-25025: RowSet with XML tag:Tab1View failed.
    at oracle.jbo.server.ViewObjectImpl.updateRowSetFromXML(ViewObjectImpl.java:10243)
...
## Detail 0 ##
java.lang.NullPointerException
    at oracle.jbo.server.ViewRowImpl.readAttrsFromXML(ViewRowImpl.java:2929)
...

The easiest way to avoid this problem is to change the association and view link to a 1-to-many relation. This is the work around i’m using. Another option would be to change the view objects, by including all the attributes of Tab2View into Tab1View. Apart from this problem, bc4j’s readXml is pretty usefull.