• jdbcRowSet + repeat control: In place changes not persisted in Oracle 10 DB

    By Martin Geyer 4 years ago

    Hi,

    I am trying to create an “endless form”, where the user can edit an RDBMS table's column values directly in the form (i.e. without opening a separate “edit form” that allows to edit a single row). I am using a XPages repeat control bound to a jdbcRowSet which accesses a simple PERSON table in an Oracle 10 DB (id number primary key, first/last name, plus some additional columns not exposed in the form).

    Displaying the data and editing it works as expected, but persisting the changes back to the DB fails persistently, but without an error message. In the source code below one can see the ways I have tried to tell the data source to save the changes made, but to no avail.
    (Using the same code with a Notes datasource works as expected and persists the changes).

    How would I get the jdbcRowSet to persist the changes in the form ?

    (If anyone from IBM reads this: We have a large Notes user base in our organization, but for me to convince management to go down the XPages route vs using JDeveloper or a standard JSF stack, it would be important to also have strong (Oracle) RDBMS support, and not have it feel like it might still be treated as a second class citizen…).

    Thanks in advance for any help,
    Martin

    PS: We have Oracle DBs ranging from 10 to 12 in production, so I am testing with Oracle 10 to be on the safe side…


    <xp:view xmlns:xp=“http://www.ibm.com/xsp/core”

    xmlns:xe="http://www.ibm.com/xsp/coreex">
    
    <xp:this.data>
        <!-- <xp:dominoView var="view1Ld" viewName="AuthorView"></xp:dominoView> -->
        <xe:jdbcRowSet var="view1" connectionName="oracle10"
            sqlTable="PERSON">
        </xe:jdbcRowSet>
        <xe:jdbcQuery var="jdbcQuery1"></xe:jdbcQuery>
    </xp:this.data>
    
    
    <xp:panel id="panel0">
    
        <xp:repeat id="repeat1" rows="30" value="#{view1}" var="rpt">
            <xp:panel id="panelDocData">
                <xp:inputText id="inputText1" value="#{rpt.id}"></xp:inputText>
                <xp:inputText id="inputText2"
                    value="#{rpt.first_name}">
                </xp:inputText>
                <xp:inputText id="inputText3" value="#{rpt.last_name}"
                    showReadonlyAsDisabled="true">
                </xp:inputText>
                <xp:inputText id="inputText5"
                    defaultValue="#{rpt.last_name}">
                </xp:inputText>
            </xp:panel>
        </xp:repeat>
    
        <xp:br></xp:br>
        <xp:inputText id="inputText4" value="#{view1.last_name}"></xp:inputText>
        <xp:br></xp:br>
        <xp:br></xp:br>
        <xp:button value="Save" id="button1">
            <xp:eventHandler event="onclick" submit="true"
                refreshMode="complete">
                <xp:this.action><![CDATA[#{javascript:view1.acceptChanges()}]]></xp:this.action>
            </xp:eventHandler>
        </xp:button>
        <xp:button value="Simply Save" id="button3">
            <xp:eventHandler event="onclick" submit="true"
                refreshMode="complete" immediate="false" save="true">
                <xp:this.action>
                    <xp:save></xp:save>
                </xp:this.action>
            </xp:eventHandler>
        </xp:button>
        <xp:button value="Submit" id="button4">
            <xp:eventHandler event="onclick" submit="true"
                refreshMode="complete" immediate="false" save="true">
                <xp:this.action>
                    <xp:confirm
                        message="Are you sure you want to persist the changes in the database ?">
                    </xp:confirm>
                </xp:this.action>
            </xp:eventHandler>
        </xp:button>
        <xp:button value="Save Document" id="button5">
            <xp:eventHandler event="onclick" submit="true"
                refreshMode="complete">
                <xp:this.action>
                    <xp:saveDocument var="view1"></xp:saveDocument>
                </xp:this.action>
            </xp:eventHandler>
        </xp:button>
        <xp:button id="button6">
            <xp:this.value><![CDATA[Save Datasource]]></xp:this.value>
            <xp:eventHandler event="onclick" submit="true"
                refreshMode="complete">
                <xp:this.action><![CDATA[#{javascript:rpt.acceptChanges()}]]></xp:this.action>
            </xp:eventHandler>
        </xp:button>
        <xp:button value="Save View DS" id="button7">
            <xp:eventHandler event="onclick" submit="true"
                refreshMode="complete">
                <xp:this.action><![CDATA[#{javascript:view1.acceptChanges()}]]></xp:this.action>
            </xp:eventHandler>
        </xp:button>
        <xp:button value="Save View DS 2" id="button8">
            <xp:eventHandler event="onclick" submit="true"
                refreshMode="complete">
                <xp:this.action><![CDATA[#{javascript:view1.rpt.acceptChanges()}]]></xp:this.action>
            </xp:eventHandler>
        </xp:button>
    </xp:panel>
    <xp:br></xp:br>