Hi, Any thoughts on this one?
I have bandwidth this week if it's considered something we want. Thanks. On Thu, Jan 23, 2014 at 2:08 PM, Guillaume Smet <guillaume.s...@gmail.com> wrote: > Hi, > > I'm starting our migration to ORM 4.3 to be able to provide some > (hopefully useful) feedback on ORM 4.3 and Search 4.5. > > One thing we did in most of our apps was injecting Spring managed > interceptor into the session factory using a trick very similar to > what is explained there: > http://blog.krecan.net/2009/01/24/spring-managed-hibernate-interceptor-in-jpa/. > > This (kinda ugly) trick doesn't work any more in 4.3 and I ended up > doing the following: > https://gist.github.com/gsmet/8578138 > which works but is IMHO very fragile as I only changed one > initialization method and if I would have liked to change them all, I > would have to duplicate a lot of code. > > Would it be possible to create a protected method which centralizes > the call to Bootstrap.getEntityManagerFactoryBuilder( persistenceUnit, > integration, providedClassLoader ); call we could override easily? > See: > https://github.com/hibernate/hibernate-orm/blob/4.3/hibernate-entitymanager/src/main/java/org/hibernate/jpa/HibernatePersistenceProvider.java#L129 > https://github.com/hibernate/hibernate-orm/blob/4.3/hibernate-entitymanager/src/main/java/org/hibernate/jpa/HibernatePersistenceProvider.java#L150 > https://github.com/hibernate/hibernate-orm/blob/4.3/hibernate-entitymanager/src/main/java/org/hibernate/jpa/HibernatePersistenceProvider.java#L157 > > This way I could simply override this method to return a different > EntityManagerFactoryBuilder aware of my interceptor for every way to > initialize an EntityManagerFactory. > > And minor nitpicking, I think the wrap method should be protected as > it's used in a protected method we might want to tweak without having > to implement this method again. see > https://github.com/hibernate/hibernate-orm/blob/4.3/hibernate-entitymanager/src/main/java/org/hibernate/jpa/HibernatePersistenceProvider.java#L137 > > I can open a Jira issue and do the work if you agree there is > something to fix and we come up with a plan (and a clever method > name). > > Thanks for your feedback. > > -- > Guillaume _______________________________________________ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/hibernate-dev