Hope everyones having a great holiday. I didn't get any responses to an earlier query, so I came up with a plan that I wanted to ask for comments on. To repeat the problem:
--------- I have this ftl script that displays a list from an EntityListIterator. This ftl script has a link on the primary key in the list to display a second ftl screen showing the details of the fields in the selected GenericValue from the EntityListIterator. I have a request to be able to click a button from this detail screen and show the next and (hopefully) previous record from the EntityListIterator, and thereby move through the list a record at a time from the detail screen. I am passing the id field as a parameter to the detail screen and do a findByPrimaryKey() to get the detail. I can't see any GenericDelegator.findNext() or anything like it which would be exactly what I need. The entity can sometimes contain a million records or more so I would prefer not to get all the keys and then search through them, especially considering that I have an active EntityListIterator. ----------- What I have decided to try is this: Create a java class that holds an EntityListIterator, the current primary key, and a reference to a java timer. The instantiator would create the EntityListIterator and use iter.next() to move through the list until the key is found. Subsiquent calls would just do an iter.next() or iter.previous() to return the next/previous record. A java timer would be set for say... 10 minutes and if the timer goes off the owner class would be asked to destroy the object and cause EntityListIterator.close() to be called. My worries are these: 1. There would usually be two EntityListIterator on the same table/view. 2. The instantiation/iter.next() calls would come from (presumably) different threads. I am worried about this because of David's comments about transactions. A question I had is, is there a global way to know when a user accesses a different module, say going from ordermgr/control/main to partymgr/control/main. If I could detect this, I could promptly close the EntityListIterator without having to wait on the timer. Does anyone see any problems or pitfalls to avoid? Or perhaps a better and/or simpler solution. Skip No virus found in this outgoing message. Checked by AVG. Version: 7.5.519 / Virus Database: 269.21.7/1333 - Release Date: 3/18/2008 8:10 AM
