Hi,
I have a complex object which I'm pulling from Hibernate and mapping through a datasource file. Using the example I used in the previous thread; let's say this object is an "Order" and it has a createdBy and assignedTo property; both of which are of type "User".
The mapping for this object is as follows:
The problem I have is that some fields which are derived from complex objects; such as CSA and AssignedTo are optional and can be null.
When this objects are pulled from the datasource; they result in the following warning message:
The datasource still renders fine (in a ListGrid, for instance); but I would like to surpress these warnings, because my datasource could potentially have thousands of items that don't have this property set and I don't want the server logs filling up with these warnings.
The JXPath documentation indicates that for this scenario; there is a "context.setLenient(true)" option you can enable (http://today.java.net/pub/a/today/2006/08/03/java-object-querying-using-jxpath.html); but I'm not sure how to enable this with the SmartGwt server components, since the calls to JXPath are actually burried inside the SmartGWT code.
Any ideas? This has to be a pretty common occurence...
I have a complex object which I'm pulling from Hibernate and mapping through a datasource file. Using the example I used in the previous thread; let's say this object is an "Order" and it has a createdBy and assignedTo property; both of which are of type "User".
The mapping for this object is as follows:
Code:
<DataSource ID="Order" serverType="generic"> <fields> <field name="id" type="sequence" hidden="false" primaryKey="true"/> <field name="title" type="text" title="Title" length="255" required="true"/> <field name="type" type="enum" title="Type" length="20" required="true"/> <field name="status" type="enum" title="Status" length="20" required="true"/> <field name="requestedDate" type="date" title="Request Date" required="true"/> <field name="closedDate" type="date" title="Closed Date" required="false"/> <field name="account" type="text" title="Account" valueXPath="account/id" required="true"/> <field name="accountId" type="int" title="Account" valueXPath="account/id" required="false"/> <field name="accountName" type="text" title="Account" valueXPath="account/company" required="false"/> <field name="csa" type="text" title="CSA" valueXPath="csa/id" required="false"/> <field name="csaId" type="int" title="CSA" valueXPath="csa/id" required="false"/> <field name="csaName" type="text" title="CSA" valueXPath="concat(csa/account/username, ':', csa/id)"/> <field name="createdBy" type="text" title="Created By" valueXPath="createdBy/userId" required="true"/> <field name="createdById" type="text" title="Created By" valueXPath="createdBy/userId" required="false"/> <field name="createdByName" type="text" title="Created By" valueXPath="concat(createdBy/firstName, ' ', createdBy/lastName)" required="false"/> <field name="assignedTo" type="text" title="Assigned To" valueXPath="assignedTo/userId" required="false"/> <field name="assignedToId" type="text" title="Assigned To" valueXPath="assignedTo/userId" required="false"/> <field name="assignedToName" type="text" title="Assigned To" valueXPath="concat(assignedTo/firstName, ' ', assignedTo/lastName)" required="false"/> </fields> <serverObject lookupStyle="spring" bean="orderDAO"/> </DataSource>
When this objects are pulled from the datasource; they result in the following warning message:
Code:
Couldn't get value at valueXPath: assignedTo/userId for datasource: Order- ignoring. Actual error: org.apache.commons.jxpath.JXPathNotFoundException: No value for xpath: assignedTo/userId
The JXPath documentation indicates that for this scenario; there is a "context.setLenient(true)" option you can enable (http://today.java.net/pub/a/today/2006/08/03/java-object-querying-using-jxpath.html); but I'm not sure how to enable this with the SmartGwt server components, since the calls to JXPath are actually burried inside the SmartGWT code.
Any ideas? This has to be a pretty common occurence...
Comment