Has this or somethings similar become part of the framework already? I also have the problem that no Hibernate session is available in a @PostConstruct
Has this or somethings similar become part of the framework already? I also have the problem that no Hibernate session is available in a @PostConstruct
no but the patch works fine!
Thanks for the patch!
I however have a problem when using it:
I have an init() method on a DAOImpl, annotated as @PostInitialize. This method is not part of the interface.
When the method or class is also annotated as @Transactional, a proxy is created for the DAOImpl class. However the scan does not pick up the PostInitialize on this proxy as the method is not even part of the proxy method list. Adding the method to the interface didn't solve the problem either. Although it was now present, the PostInitialize annotation was not picked up. Moving the annotation to the interface doesn't help either. Does the fact that annotations are not inherited got something to do with this?
A hibernate session is required for the init() to work, thats the whole point of the PostInitializer. Should PostInitialize perhaps provide a Transaction scope to run the init() methods in?
I'm not convinced that a method like init() should always be part of the interface. I would like to leave it up to the implementer to decide if his DAO needs cache warmup.
I'm using spring 3.0.4.
Last edited by fiaskow; Nov 2nd, 2010 at 02:37 AM.
fiaskow, not sure it can be done. You see, all we do is plain old Java reflection. We got an object and check for its methods (in all morphs). If the object itself is Spring proxy, created by usual Spring AOP (JDK dynamic proxy) it will contain only the methods of the interface.
would like to leave it up to the implementer to decide if his DAO needs cache warmup.
Hi folks.
I have experimented with @PostInitialize and finally I have decided to use TransactionalTemplate. It works well without problems for us.
I described it here - http://javatweet.blogspot.com/2011/0...sses-post.html
cool,
just for ease of use (one download rather than two), I'm re-posting the complete patched version, with the exclusion of a debug print that mistakenly infiltrated the code previously.
Thanks for the patch. It's working fine, with @Transactional and @PostInitialize.
However, I did found one issue with it.
When the Bean using the @PostInitialize have an interface, the runner does not work, as it tries to iterate the Proxy methods instread of the class mathods.
I'm using spring 3.1.
Anyone know of a newly added feature in spring 3.1 that can work around this issue, w/o PostInitialize?