Return-Path: Delivered-To: apmail-cayenne-commits-archive@www.apache.org Received: (qmail 87250 invoked from network); 12 Feb 2007 02:46:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Feb 2007 02:46:52 -0000 Received: (qmail 15050 invoked by uid 500); 12 Feb 2007 02:46:38 -0000 Delivered-To: apmail-cayenne-commits-archive@cayenne.apache.org Received: (qmail 15005 invoked by uid 500); 12 Feb 2007 02:46:38 -0000 Mailing-List: contact commits-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cayenne.apache.org Delivered-To: mailing list commits@cayenne.apache.org Received: (qmail 14809 invoked by uid 99); 12 Feb 2007 02:46:37 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 11 Feb 2007 18:46:37 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 11 Feb 2007 18:43:00 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id 4519C1A981A; Sun, 11 Feb 2007 18:42:40 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r506232 - /cayenne/site/trunk/tlp-site/target/articles/082006/cayenne-gef/index.html Date: Mon, 12 Feb 2007 02:42:40 -0000 To: commits@cayenne.apache.org From: aadamchik@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070212024240.4519C1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: aadamchik Date: Sun Feb 11 18:42:39 2007 New Revision: 506232 URL: http://svn.apache.org/viewvc?view=rev&rev=506232 Log: updating GEF article links Modified: cayenne/site/trunk/tlp-site/target/articles/082006/cayenne-gef/index.html Modified: cayenne/site/trunk/tlp-site/target/articles/082006/cayenne-gef/index.html URL: http://svn.apache.org/viewvc/cayenne/site/trunk/tlp-site/target/articles/082006/cayenne-gef/index.html?view=diff&rev=506232&r1=506231&r2=506232 ============================================================================== --- cayenne/site/trunk/tlp-site/target/articles/082006/cayenne-gef/index.html (original) +++ cayenne/site/trunk/tlp-site/target/articles/082006/cayenne-gef/index.html Sun Feb 11 18:42:39 2007 @@ -9,7 +9,7 @@

Combining GEF and Cayenne

By Marcel Gordon, August 2006

1 ABSTRACT

-

GEF is a powerful Eclipse-based framework for enabling visual interaction with models. Cayenne is an open-source project which provides object-relational mapping, translating from data in a relational database to objects in Java. The two technologies combine fluidly to allow visual editing of data from a database. This article gives a high level explanation of the structure of an application which utilises GEF and demonstrates the use of Cayenne persistent objects as a model for GEF through the development of a visual database editor.

+

GEF is a powerful Eclipse-based framework for enabling visual interaction with models. Cayenne is an open-source project which provides object-relational mapping, translating from data in a relational database to objects in Java. The two technologies combine fluidly to allow visual editing of data from a database. This article gives a high level explanation of the structure of an application which utilises GEF and demonstrates the use of Cayenne persistent objects as a model for GEF through the development of a visual database editor.

2 INTRODUCTION

Graphical editing is one of the most intuitive and effective ways to allow users to manipulate data. Diagrams convey a wealth of information in a simple fashion. Simple for the user, in any event; creating such applications can be a time-consuming process for the developer. Enter GEF, the Eclipse project's Graphical Editing Framework. GEF allows the rapid development of visual editors by providing a framework for display and interaction, leaving the developer free to focus on the user experience.

GEF utilises the well-known Model-View-Controller pattern. Usually the application's model will comprise of simple Java objects, but more sophisticated applications can take advantage of the Eclipse Modeling Framework (EMF). However, for many applications the data which underlies the model resides in a database. Translating from the relational structure to Java objects can be burdensome and conceptually difficult.

@@ -19,7 +19,7 @@

This article explains the design of a simple database editing tool. The editor allows users to run a query and display the results, expand relationships between tables, insert and delete records, alter relationships between records and edit the value of fields.

Database Editor in action

3.1 Running the editor

-

The source code for the editor can be checked out of the repository. The application consists of two Eclipse projects. The client is an Eclipse plugin and the server is a web application. The following are required in order to run the editor: +

The source code for the editor can be checked out of the repository. The application consists of two Eclipse projects. The client is an Eclipse plugin and the server is a web application. The following are required in order to run the editor:

@@ -37,7 +37,7 @@ FieldAttribute Foreign key constraintRelationship

-

Cayenne provides a GUI tool known as the Modeler in order to facilitate the mapping of a database. If the database already exists, the Modeler can generate the mapping automatically. Alternatively, the Modeler can be used to design and create a database and the associated mapping. Either way, upon completion of the mapping process Cayenne has the metadata which it needs. This is used to generate Java classes for use in the application, and the developer never need deal with the database directly again.

+

Cayenne provides a GUI tool known as the Modeler in order to facilitate the mapping of a database. If the database already exists, the Modeler can generate the mapping automatically. Alternatively, the Modeler can be used to design and create a database and the associated mapping. Either way, upon completion of the mapping process Cayenne has the metadata which it needs. This is used to generate Java classes for use in the application, and the developer never need deal with the database directly again.

Cayenne stores its mapping metadata in XML files. The database editor includes metadata files for a simple database involving three entities - Artist, Painting, and Gallery - commonly used in the Cayenne documentation. As we will see below, you can use the database editor with a different database simply by replacing these files with your own.

Entity type hierarchy

3.2.1 Cayenne's persistent classes

@@ -561,7 +561,7 @@
[1] Randy Hudson, 'Create an Eclipse-based application using the Graphical Editing Framework' at http://www-128.ibm.com/developerworks/opensource/library/os-gef/; Bo Majewski, 'A Shape Diagram Editor' at http://www.eclipse.org/articles/Article-GEF-diagram-editor/shape.html; Phil Zoio, 'Building a Database Schema Diagram Editor with GEF' at http://www.eclipse.org/articles/Article-GEF-editor/gef-schema-editor.html; IBM, 'Eclipse Development using the Graphical Editing Framework and the Eclipse Modeling Framework' at http://www.redbooks.ibm.com/Redbooks.nsf/RedbookAbstracts/sg246302.html
[2] Randy Hudson's article (above n 1) introduces this idea with the terms 'business' and 'view'. I use 'visual' rather than 'view' in order to avoid confusion with the use of the term 'view' in MVC.
[3] Daniel Lee, 'Display a UML Diagram using Draw2D' at http://www.eclipse.org/articles/Article-GEF-Draw2d/GEF-Draw2d.html. -
[4] See http://cwiki.apache.org/confluence/display/CAY/Cocoa+Cayenne. +
[4] See http://cwiki.apache.org/CAY/cocoa-cayenne.html.