imperfectgrist
imperfectgrist

Reputation: 641

Foreign Key Lookup in WaveMaker 6.7

I'm currently evaluating WaveMaker for a project at work and am experiencing trouble performing a foreign key lookup. I'm running WaveMaker 6.7 and connecting to an Oracle Database 10g instance.

My project involves designing a pretty simple "Project Approval" screen. In WaveMaker's implementation, it should consist of a DojoGrid associated with the RequestApproval table and a LiveForm associated with the selected element in the table providing CRUD operations on that element.

Each row in the RequestApproval table represents a task in a project. The table includes a nullable StaffAssigned column that indicates which staff member is assigned to a task. To validate new entries and preserve data integrity, the StaffAssigned column is a foreign key into the Respinit table, the primary key of which defines all staff members. The foreign key is defined in the database, and on import WaveMaker assigns it a cardinality of "to-zero-or-one" (because, I think, the StaffAssigned column is nullable).

My problem is that not all the conveniences WaveMaker should provide me now that Hibernate has a mapping of the relationship are available to me. As long as that foreign key is defined on the StaffAssigned column, the column will not appear in the DojoGrid. None of the associated columns from the Respinit table appear as selectable in the "Edit columns" dialog of the DojoGrid either. (Perhaps this is because WaveMaker wouldn't know what to display when StaffAssigned is null?) No Lookup editor appears by default in the LiveForm, but when I drag one over from the Pallete the new editor is automatically associated with the foreign key and will auto-populate with values from the Respinit table when I run my app.

Here's the defintion of the RequestApproval table in Hibernate:

<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
    <class name="com.db105ddb.data.RequestApproval" table="REQUEST_APPROVAL" schema="VRT" dynamic-insert="false" dynamic-update="false">
        <id name="requestApprovalId" type="integer">
            <column name="REQUEST_APPROVAL_ID" precision="9"/>
            <generator class="assigned"/>
        </id>
        <property name="REQUESTNUM" type="integer">
            <column name="REQUESTNUM" precision="8" not-null="true"/>
        </property>
        <property name="taskDescription" type="string">
            <column name="TASK_DESCRIPTION" length="2000"/>
        </property>
        <property name="whoRequestedApproval" type="string">
            <column name="WHO_REQUESTED_APPROVAL" length="6"/>
        </property>
        <property name="dateRequested" type="date">
            <column name="DATE_REQUESTED" length="7"/>
        </property>
        <property name="dateApproved" type="date">
            <column name="DATE_APPROVED" length="7"/>
        </property>
        <property name="WHO_APPROVED" type="string">
            <column name="WHO_APPROVED" length="6"/>
        </property>
        <many-to-one name="respinitByStaffAssigned" class="com.db105ddb.data.Respinit" cascade="none">
            <column name="STAFF_ASSIGNED" length="6"/>
        </many-to-one>
    </class>
</hibernate-mapping>

And here's the definition of the Respinit table:

<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
    <class name="com.db105ddb.data.Respinit" table="RESPINIT" schema="VRT" dynamic-insert="false" dynamic-update="false">
        <id name="respinit" type="string">
            <column name="RESPINIT" length="6"/>
            <generator class="assigned"/>
        </id>
        <property name="rname" type="string">
            <column name="RNAME" length="40"/>
        </property>
        <property name="rnameaddr" type="string">
            <column name="RNAMEADDR" length="40"/>
        </property>
        <property name="raddr1" type="string">
            <column name="RADDR1" length="40"/>
        </property>
        <property name="raddr2" type="string">
            <column name="RADDR2" length="40"/>
        </property>
        <property name="rcity" type="string">
            <column name="RCITY" length="40"/>
        </property>
        <property name="rstate" type="string">
            <column name="RSTATE" length="20"/>
        </property>
        <property name="rzip" type="string">
            <column name="RZIP" length="20"/>
        </property>
        <property name="homephone" type="string">
            <column name="HOMEPHONE" length="20"/>
        </property>
        <property name="extension" type="string">
            <column name="EXTENSION" length="5"/>
        </property>
        <property name="department" type="string">
            <column name="DEPARTMENT" length="20"/>
        </property>
        <property name="cgroup" type="string">
            <column name="CGROUP" length="10"/>
        </property>
        <property name="emailaddress" type="string">
            <column name="EMAILADDRESS" length="1024"/>
        </property>
        <set name="requestApprovalsForStaffAssigned" inverse="true" cascade="">
            <key>
                <column name="STAFF_ASSIGNED" length="6"/>
            </key>
            <one-to-many class="com.db105ddb.data.RequestApproval"/>
        </set>
    </class>
</hibernate-mapping>

I would really like my StaffAssigned column to show up in my DojoGrid, and I'm not sure why it's not. Other foreign key lookups I've done with Wavemaker work as expected. Can anyone tell if I've done something wrong in my configuration? Is my approach non-standard in some way? Any help will be greatly appreciated and I will happily provide any additional information on request.

Upvotes: 1

Views: 230

Answers (1)

imperfectgrist
imperfectgrist

Reputation: 641

I found the answer buried in their documentation. If one needs to view/edit related data, you have to use a LiveView instead of a LiveTable. Here's a link to the Wayback Machine's archive of the documentation in question since their website has been down all week.

Upvotes: 1

Related Questions