javahibernatejpapersistence

can i override singleTableEntityPersister for all my entities?


to be able to change some property to customType as result of some new annotation i will create i need to be able to extend singleTableEntityPersister for all my entities , is there any way to do this ?


Solution

  • To be able do it I added to hibernate.properties:

    hibernate.persister.resolver=MyPersisterClassResolver
    

    and created a new PersisterClassResolver class as follows:

    public class MyPersisterClassResolverextends StandardPersisterClassResolver {
        @Override
        public Class<? extends EntityPersister> singleTableEntityPersister() {
            return mySingleTabkePersister.class;
        }
    }