<bean id="viewEmployee" type="entity">
<entityType>HR.EMP</entityType>
<mode>VIEW</mode>
<criteriaElements>
<function name="EQ" property="nid">100</function>
</criteriaElements>
<viewConfig>
<viewType>ENTITY</viewType>
</viewConfig>
</bean>
<bean id="queryEmployees" type="entity">
<entityType>HR.EMP</entityType>
<criteriaElements>
<function name="EQ" property="type">FULL_TIME</function>
</criteriaElements>
<viewConfig>
<viewType>QUERY</viewType>
<propertiesToHide>type</propertiesToHide>
</viewConfig>
</bean>
Query supports search options such as group by and order by properties. For example,
retrieve sum(order.total) group by customer, and order by customer(ascending)
and sum(order.total) (descending).
<bean id="queryOrders" type="entity">
<entityType>Sales.SO</entityType>
<criteriaElements>
<function name="IS_NOT_NULL" property="payment"></function>
</criteriaElements>
<searchOptions>
<groupBy>customer</groupBy>
<asc property="customer"/>
<desc property="total"/>
</searchOptions>
<viewConfig>
<viewType>QUERY</viewType>
<showSearchOptions>false</showSearchOptions>
<viewConfig name="queryResults">
<viewType>ENTITY_LIST_WIDE</viewType>
</viewConfig>
</viewConfig>
</bean>
Order.total is a statistics property(SUM), and "order by total" is actually order by
sum(order.total) for group-by query. Refer to
Entity Backing Bean on Statistics Properties.
<bean id="createExpenseClaim" type="entity">
<entityType>HR.EC</entityType>
<mode>CREATE</mode>
<criteriaElements>
<function name="EQ" property="expenseClaimItems">
<expenseClaimItem>
<code>00</code>
<expense>200.00</expense>
</expenseClaimItem>
<expenseClaimItem>
<code>01</code>
<expense>300.00</expense>
</expenseClaimItem>
</function>
</criteriaElements>
<viewConfig>
<viewType>ENTITY</viewType>
</viewConfig>
</bean>
<viewConfig>
<viewType>ENTITY</viewType>
<param name="entity.not.found" value="ignore" />
</viewConfig>
Parameter: entity.not.found. (default: error)
If present, show the specified message instead of the default message if the entity is not found. The message will be shown even if the value of the parameter entity.not.found is "ignore".
Page: /createExpenseClaim.xpg
<bean id="checkEmployee" type="entity">
<entityType>HR.EMP</entityType>
<mode>VIEW</mode>
<criteriaElements>
<function name="EQ" property="user">#{containerBean.authenticatedUser}</function>
</criteriaElements>
<viewConfig>
<viewType>ENTITY</viewType>
<!-- entity not found: redirect to a URL -->
<param name="entity.not.found" value="redirect:EntityNotFound" />
<redirect action="EntityNotFound" toURL="/createEmployee.xpg">
<add name="redirectAfterCreate" value="#{containerBean.viewInfo.bookmarkableURL}" />
</redirect>
</viewConfig>
<hidden>true</hidden>
</bean>
<bean id="createExpenseClaim" type="entity">
<entityType>HR.EC</entityType>
<mode>CREATE</mode>
<viewConfig>
<viewType>ENTITY</viewType>
</viewConfig>
</bean>
Page: /createEmployee.xpg
<bean xmlns="http://www.znize.com/platform/objects"
id="createEmployee" type="entity">
<entityType>HR.EMP</entityType>
<mode>CREATE</mode>
<criteriaElements>
<function name="EQ" property="user" nullable="false">#{containerBean.authenticatedUser}</function>
</criteriaElements>
<viewConfig>
<viewType>ENTITY</viewType>
<redirect action="cmd.Create"
enabled="#{!empty param.redirectAfterCreate}"
toURL="#{param.redirectAfterCreate}">
</redirect>
</viewConfig>
</bean>
<bean id="userSignUp" type="entity">
<entityType>System.USR</entityType>
<mode>CREATE</mode>
<viewConfig>
<viewType>ENTITY</viewType>
<param name="countries" value="US,CN" />
</viewConfig>
</bean>
Parameter: countries