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.

Keine Kommentare:

Kommentar veröffentlichen