Skip to content

Proposal encapsulated persister level metadata

Steve Ebersole edited this page Jul 23, 2013 · 1 revision

Currently persister-level metadata is exposed in a very non-encapsulated way. Clients need to resolve a property name into a proper "index" (that is relative to internal persister state), and then keep passing that "index" into the persister method calls to get piece-meal information about properties. There is also a lot of checking of property Types (by index of course) to see which pieces of information are available.

Good OO design says that all this information should be better encapsulated. That is exactly the purpose of the new org.hibernate.persister.walking package. The main entry points into this new SPI are through the org.hibernate.persister.walking.spi.EntityDefinition and org.hibernate.persister.walking.spi.CollectionDefinition contracts implemented by EntityPersister and CollectionPersister respectively. Composite values are modeled via org.hibernate.persister.walking.spi.CompositionDefinition. These contracts take much of the lessons learned in the ongoing 5.0 metamodel work in terms of modeling information about the user domain model and its Object/Relational Mapping and applies them to the runtime metamodel.