Java annotations and ORM generation


I added @Cacheable and @Cache(CacheConcurrencyStrategy.READ_ONLY) to some of my classes. The orm generates the annotations correctly but I also need the ORM to add the following two import statements. Is there a way to include import statements on the entities generated by the ORM?

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

Thank you,


I got the following reply from tech support:

I regret that we do not support adding those annotations to the generated code. Can you use fully qualified path in annotation?

A fully qualified path would work too.


Hi Mathias,I have also implemented mioeimlthuds in a java framework that I am working on.I too wanted to be able to use abstract methods instead of interfaces so that I could put default implementation of methods in the interfcae definitions.Anyway, I am currently using the cglib library instead of Java proxies.It was very easy to replace java.lang.reflect.Proxy class with the net.sf.cglib.proxy.Enhancer class.Basically the Enhance lets you create a proxy using abstract classes instead of interfaces.Here’s an example of how to use it 123456Enhancer enhancer = new Enhancer(); enhancer.setSuperclass(roleClass); enhancer.setInterfaces(new Class[] { MeteorProxy.class }); enhancer.setCallback(new RoleInvocationHandler(_repository, this, roleClass)); enhancer.setClassLoader(Activator.getMeteorClassloader()); role= (T)enhancer.create(); the classes passed to the setInterfaces method may include abstract classes as well as interfaces.Best Regards,ted stockwell