I've been using the SQLAssembler quite successfully so far,
but I've hit a small snag.
I'd like to poll for changes to the result of the DB queries
and update the clients when a change occurs. Before I'd got into
the javadocs in detail I'd assumed that triggering a refreshFill
would do what I wanted, and my Java method looked something like
this:
public void refresh()
{
DataServiceTransaction dst =
DataServiceTransaction.begin(false);
dst.refreshFill("sql-helpdesk", null);
dst.commit();
}
Having checked the docs I can see that this approach isn't
going to work, and that I need to use updateItem on the DST to
update each individual changed item, since refreshFill only looks
for new or deleted items.
The first barrier I've hit is that I need to get the object
which has changed, and pass it to updateItem. I'm not sure how to
go about obtaining the list of objects.
The way that seems most logical would be to perform the a
fill operation on the server which is the same as the Flex clients
perform, but store the results on the server, and then at the next
poll interval make a new fill and compare it to the last, calling
updateItem for each changed item.
I was hoping there have thought there would be some
equivalent to the DataService component as it is used in the Flex
client, whereby I could request a service for a particular
destination name, and then perform a fill operation. Unfortunately
the class named DataService for the Java API seems more to do with
managing destinations than actually using them.
Has anyone else solved the problem of direct changes made to
the database not being picked up, aside from clients discarding
fills and building them completely from scratch so as to pick up
the changes?
Something which is on my wishlist if I can solve this problem
is to extend or adapt the SQLAssembler to actually look for changes
rather than just new or deleted items, and then roll out property
changes to the clients as part of the refreshFill method. There is
probably a good reason why refreshFill doesn't perform the updates,
if anyone knows why it doesn't it may save me a journey down a
blocked path.
Also, is the source code for the SQLAssembler available
somewhere, or just the HibernateAssembler?
Thanks in advance,
Robert Hirst