Showing posts from November, 2009

Retrieving deleted Entity Objects

I have seen a couple of use cases where developers need to iterate through the deleted Entity Objects and perform validations based on various conditions. Steve shared some pointers, which helped me to find a solution. The following code snippet may help you to identify the deleted entities. public class EmployeesImpl extends EntityImpl { public ArrayList<EntityImpl> findDeletedEmployees() { ArrayList<EntityImpl> deletedList = new ArrayList<EntityImpl>(); Iterator iterator = this.getEntityDef(). getAllEntityInstancesIterator (this.getDBTransaction()); while (iterator.hasNext()) { EmployeesImpl emp = (EmployeesImpl); if (emp.getEntityState() == Entity.STATUS_DELETED) { // Keep soft ref. if worried on GC deletedList.add(emp); } } return deletedList; } // Rest

Creating a Data Capture Form using EJB + JPA and ADF Binding

Java EE technology stack has been improved tremendously in recent past. However, a closer look at this technology spectrum reveals the visible gap that exists between the UI and Service layers. Core Java EE stack really lacks a smart glue layer that avoids large chunk of boiler plate code used for wiring UI with business data. For a typical Java EE business application, we can say that about 20-25% coding effort is being spent for wiring UI to the data from business services and other common UI manipulations such as synchronizing master-child relations, querying entities and displaying results, navigating between records, invoking actions etc. Binding the UI with EJB Is there any matured binding solution available for Java EE technology stack? Answer is YES, Your friend is ADF binding layer who can really help you to bridge the gap between UI and business service layer. Seeing is Believing So let us try building a data capture form using Java EE technology stack with the help

Displaying pre-executed query result in a search form

I recently encountered an interesting use case related to Search Binding. Requirement is to display the result of pre executed query in a search form embedded inside a popup dialog. Developer tried executing the query from popupFetchListener, but no success in displaying the search result back on the form. Always search result component comes empty. What has gone wrong here? Before start seeing the implementation part, let us try to understand the model driven query component's runtime behavior. <af:query> component's binding(search binding) by default, follow 'AutoQuery-or-ClearRowSet' behavior. In simple words, search binding for <af:query> component will try to perform either of the below steps(AutoQuery or ClearRowSet) while rendering the page where the component is embedded. AutoQuery : <af:query> component follows model driven rendering approach. Obviously the ViewCriteria defined in the ViewObject, decides query component's runtime beha

Accessing web tier variable values from the business components in a groovy way

Groovy is an amazing dynamic language with lots of unnoticed features. One feature that I like most is the dynamism that can be introduced to an enterprise application at runtime. To know more about the groovy support in ADF, please go through this white paper : Introduction to Groovy This 'dynamism' fits pretty well for an ADF based application in many scenarios. However, there are few cases where this feature is being used in a non groovy way :) Accessing web layer data from business components Rule of thumb for designing a system is that client layer can  depend upon your business service layer, not the other way around. This provides more flexibility and extensibility to the system. Your build tool (say for e.g.: maven) may also expect a unidirectional dependency, to resolve dependencies without getting into infinite loops. However, there are some use cases where EntityObjects or ViewObjects needs to be initialized with values from the client side(web tier). Cons