Hibernate / EclipseLink Interview questions
What is a Customizer in EclipseLink?
A Customizer is a class implementing EclipseLink's DescriptorCustomizer interface, giving programmatic access to an entity's internal ClassDescriptor at startup, after annotations and XML mappings have already been processed. It's the escape hatch for configuring things that don't have a corresponding standard JPA or EclipseLink annotation.
public class EmployeeCustomizer implements DescriptorCustomizer { @Override public void customize(ClassDescriptor descriptor) { descriptor.getQueryManager().checkCacheForDoesExist(); descriptor.setAlias("Emp"); } }
The customizer is registered on the entity with @Customizer(EmployeeCustomizer.class), and EclipseLink invokes its customize() method once, during metadata processing, letting it fine-tune caching behavior, add native query redirectors, or configure mappings too specialized to express declaratively.
More Related questions...