Montag, 17. August 2009

Vl - GWT to Appengine - JPA Issues

-- Appengine and JPA ---
One of the things that bugs me about GWT's appengine JPA support is the fact that owned many-to-many relationships are not possible.

The only way to break this issue would either be to use unidirectional relationships (not always a suitable option) or to create a Mapping class much like a Mapping table.
Of course, creating such a class and correctly connect it with appropiate one-to-many relationships is not easy either.

Conclusion: For all simpler usecases I will use unidirectional connections:

Examples:
AgeGroups and Competitions: Competition -> AgeGroups, as the other way round is only needed to associate agegroups to a competition, a very seldom usecase.
Events and Competititions: Event -> Competition. Hierarchically seen, its quite common to list the competitions for an event, but not to which events a competition belongs.

Competition - Participants. A mapping class must be created anyway because of the special values. The following Relationships can be found in the participation class:
unidirectional OneToMany: Each P. belongs to an event, but the events do not need to know all participations
bidirectional OneToMany: Each P. belongs to a competition, an each competition knows all of its participants

Luckily, that seems all. I feared that many to many would pose much more problems.

Still questionable is the construct participation: Maybe it would be easier to create a join object for competition and event, but on the other hand, it should be enough to restrict that via the ui and the daos.

-- GWT and JPA --
If it works as specified, combining JPA and GWT should be no problem. I either must declare a new package for the JPA-Classes (as they are not available on the client if packed in the server package) or i must find out how to create a "shared" repository with classes not connected to either the client or the server.

The last one would be cleanest solution, but I think it will be - at least for the beginning - also the most unlikely. There should be no problem for the server if everything is packed into the client package - at least i hope so.

The great advantage of these things is that I can use exactly the same objects on both the client and the server without any problems. This is extremely elegant and ensures maximum compatibility with both the database server and the javascript GUI.

VL - GWT to Appengine

A new experience i wanted to make was wether it would be possible to create a gwt application based on an appengine server, which is capable of being deployed to "offline servers".

More exactly: I want to create an application which natively runs on the appengine server with multiple users but also offers to option to create "deliverables" of the datastore and an additonal jar which could be integrated into a "normal" appserver like a jboss for situations where an internet connection is either not possible or where it would be too risky too depend on both the internet and the appengine to be reachable.

The application is question is a re-implementation of a very old program dos, VL (VolksLauf). The program in question should be able to register data and participants for various running competitions taking place at the same day. For this task, a humble worker has to enter all participant registrations (currently manually) into the system about 1 week before the event starts. During the event, the program is used to retrieve the time lists and calculate the rankings as well as printing the records.

What I want is a gwt-based frontend (just a simple java gui) with powerful data input mechanisms, import filters and exports in the form of a record printer. The backend should be an appengine application with mandate-separated datablocks. In other words, multiple users can use the app at once with completely independent data. However, since the google accounts do not work offline, there must also be an offline solution usable on a "normal" webserver. This offline solution is just an export of the database with the user data only (no data from the others) and a much simpler account management (if any). This could be used for events where either internet is not possible or to reduce the dependence no both a good connection AND the appengine. It would be a catastrophe if there would be no connection at the critical day.

After the event, the data could be restored on appengine by re-importing the deliverable and overwriting all former data of the user that way.

Well.. we will see wether i have the endurance to finish the entire application or if just create some gwt widgets and then give up. Currently, I am taking care mostly of the application skeleton on the client.