PAJES 3.0.21

Package org.pajes.db.entity

Provides simple object-relational database mapping classes.

See:
          Description

Class Summary
Attributes A representation of the atributes of a single column in a database entity.
DefaultEditor Abstract super-class of all classes that create a Paje to edit or display an Entity object.
DefaultLister Default concrete implementation of a Lister that displays all columns of all Entity objects in a table.
DefaultStyleSheet StyleSheet used by DefaultEditor and DefaultLister.
DefaultViewer Abstract super-class of all classes that create a Paje to edit or display an Entity object.
Editor Abstract super-class of all classes that create a Paje to edit or display an Entity object.
EditorTemplate Generates an Paje instance to edit an Entity.
Entity A representation of a database entity.
JoinScope Creates an ON clause suitable for use in a SQL join.
Lister Abstract super-class of all classes that create a Paje with a list of Entity objects.
ListerTemplate Generates an Paje instance to display a lost of Entity objects.
MaintenanceDisplayElement Abstract super-class of all classes that create a Paje to display an Entity object.
MaintenanceServlet Servlet to manage Entity objects.
Manager Provides the data access layer for Entity instances.
PagingLister Abstract super-class of all classes that create a Paje with a list of Entity objects, that support showing a subset of all Entity objects and paging through the subsets.
Registry Singleton registry of active Manager instances.
Scope Creates a WHERE clause suitable for use with a SQL select, update or delete java.sql.PreparedStatement.
Value A representation of the value in a single column in a single entity (row) in a database entity.
Viewer Abstract super-class of all classes that create a Paje to display an Entity object.
ViewerTemplate Generates an Paje instance to view an Entity.
 

Exception Summary
EntityException Thrown when a run-time exception relating to Entity processing occurs.
EntityNotFoundException Thrown when a request is made to retrieve a non-existent Entity.
 

Package org.pajes.db.entity Description

Provides simple object-relational database mapping classes.

To define an entity, you sub-class Manager and tell it what Entity sub-class and ConnectionPool you want it to use.

For the Manager sub-classes, you define a Attributes for each database column you want to access, and create public set/get methods in the Entity to access the attributes and their values.

Everything is then automatic, or you can over-ride the insert, update, delete and select SQL statements in the Manager for complex Entitys or to use stored procedures.

By default, it does all the good stuff like using the original values of all fields in the WHERE clause of an update for optimistic locking, only updating fields that have changed, sourcing Attributes values from the HttpServletRequest object or a ResultSet, etc. You can also use the Entity.assignInputFieldValues(org.pajes.html.TraversableElement) method to automatically populate the input fields on an HTML page with the values from an Entity.

So, to populate all the input fields on an edit screen requires 3 method calls:

  1. Get the Manager from the Registry;
  2. Retrieve the Entity; and
  3. Call Entity.assignInputFieldValues(org.pajes.html.TraversableElement).

To save the changes to an Entity from an HTTP POST request requires 4 method calls:

  1. Get the Manager, from the Registry;
  2. Retrieve the Entity (or create a new one for an insert);
  3. Call the Entity.setValues(HttpServletRequest) method (or call Entity.setDeleted(boolean) if you want to delete it instead), and
  4. Call the Entity.save() method, which automatically works out whether to do an insert, update or delete.

AND you haven't written one line of SQL...


PAJES 3.0.21

Copyright 1998-2007 Viridian Pty Limited. All Rights Reserved.