Reference » Hibernate Integration

Hibernate Integration

Last modified by Andreas Hahn on 2011/06/09 09:44

Hibernate and Shept - concept of integration

Shept uses Hibernate for data provisioning and while that is not carved in stone a pluggable architecture would require some extra work in a couple of places. First it is important to understand the design of data provider integration. All parts of a shept page that wish to reload data from their defined data source need to implement the Refreshable pl.png interface. This is true for the default datagrid backing class FilteredListHolder pl.png and it is a recommendation for all custom implementations as well. Refreshable demands for a FilterDefintion pl.png and keeps track of the filter in use that the calling handler can decide if a reload is required on #refresh() when the filter didn't change. FilterDefintion pl.png is the main entry point for filter specifications and out-of-the box shept provides 4 default implementations - 2 of these are hibernate specific and support the Hibernate query API pl.png and criteria API pl.png.
More details and a decision matrix can be found on the filter definition page.

FilterDefinition and SubInterfaces / Implementations

The FilterDefinition interface serves a double purpose: as a marker interface requiring a concrete SubInterface implementation for retrieving data and demanding the #getNewModelTemplate() method returning a ModelCreation pl.png object. If the returned object is 'NULL' the segment doesn't support the 'C' in CRUD - creation of new objects. Otherwise the segment handler needs to take care that #getNewModelTemplate() returns a populated instance of the object that serves as a template to be created for that row. This is documented in more detail in the subform lifecycle. Filters and the FilterDefinition interface are documented in the reference.

Other data providers

When the Refreshable interface is triggered to perform a #refresh() its execution is delegated to the ScrollingListProviderFactory pl.png which provides an appropriate ScrollingListProvider pl.png for the FilterDefinition in use. Currently there are only providers for hibernate implemented. The ScrollingListProviderFactory needs to be extended or better should be rewritten to support plug-ins for other providers. There are also a couple of places (DaoUtils pl.png ... ) where Hibernate Metadata pl.png is the last resort to supply generic copies of entity model objects.

Created by Andreas Hahn on 2011/06/08 18:24

© 2011 - Andreas Hahn