I am using ant and hibernate tools 3.2.5.beta (best version I can find) to do reverse engineering.
Step 1, reverse engineer database into hbm files with <jdbcconfiguration> and <hbm2hbmxml>.
Step 2, using <configuration>, generate annotated java files with <hbm2java>, and a cfg file for annotations with <hbm2cfgxml>.
Step 3, using <annotationconfiguration>, generate Spring DAOs with <hbmtemplate>.
All works well, except that if in between step 2 and 3, I put a named query into a entity pojo, <annotationconfiguration> doesn't pick it up.
When I edit the hbmxml file to add the query instead of the entity pojo and use the <configuration>, the queries are picked up. It makes me think that it is <annotationconfiguration> that is failing me. One thing that casts doubt on that is that I see the following logging statement when it is running:
Code:
INFO - Binding Named query: findAllSubsetsX => from Subset
But like I say, it doesn't show up in the DAO.
So, thinking it was my custom template, I switch to using <hbm2dao> with the same results. If fact I also copied the dao ftl file
Code:
<#foreach queryName in cfg.namedQueries.keySet()>
but with no change.
I am pretty committed to using annotated pojos, but if I must, I might make an xml file with the queries and use xsl to massage the hbmxml files.
I have also tried using javax.persistence.NamedQuery, org.hibernate.annotations.NamedQuery. Tried wrapping the single query in @NamedQueries, etc.
Is this something that doesn't work?
Also, problem #2 (and related to my complex reverse engineering scheme) the jira ticket for cascades is fixed (version 3.2.4.GA). I have cascading foreign keys in my database but I don't see them in the annotations. Do I not know how to use this?
(edit: jira ticket HBX-623)Thanks, as always.
Jeff