Hi,
I'm trying to start using annotations for NamedQueries instead of using hbm.xml files, however, I am running into a significant issue here. I've been using the HibernateTools eclipse plugin to generate Entity Types/Models, but I am running into a significant issue. From what I understand about JPA and NamedQueries, the annotation has to be part of the @Entity class. However, if I add named queries to the entity model, and then need to regenerate my entity (new fields, etc in the hbm file), then I end up losing all my named queries.
I tried adding the queries to the hbm file, expecting them to be generated as annotations in the entity model, but they weren't inserted there.
Is it just me, or am I missing something in the configuration? I have trouble believing that this is the way the Hibernate Tools and named queries are supposed to work.
Is there way I can put my NamedQueries in some other class (ex: my DAO class)?
Thanks,
Eric
|