My apologies if this is a question already addressed somewhere, but my searches on the forum have not been fruitful. Before I ask my question let me sketch in some background...
My company has a C# solution, using Microsoft SQLServer stored procedures and Data Access Layer created by code generation tools: NetTiers and Codesmith. This generates DAOs with method calls to Stored Procedures - essentially wrappers to various CRUD-like Stored Procedures.
Because we have adopted a new tech direction, I am now considering hibernate/Java solution. Thus far, I have successfully used Middlegen/Hibernate (tools like <hbm2cfgxml/>, <hbm2java />, and <hbm2dao/>) to auto-generate a complete set of *.hbm.xml, DTOs, and DAO classes. To my surprise everything builds and runs successfully (I needed to tweak the hibernate-tool's ftl for adding a couple things). This code uses the normal table mapping and corresponding DAOs which use dynamic SQL, etc.
Naturally, I'm now asked to reproduce what we had done using the netTiers and Codesmith (for MS-SQL and Oracle). Although I can write the SP-access by hand, I need to know if the same Middlegen/Hibernate tools can be used to auto-generate the *.hbm.xml and DAO-wrapper classes that I need. One thought I had was to modify the hibernate-tool's ftl for this, but I'm not sure how to "detect" the stored procedures from database. Before I write a new hibernate tool extension, I need to know if there is an existing tool (such as <hbm2dao/>) for this? Has anyone successfully accomplished code generation for *.hbm.xml and DAO/stored proc wrappers with Hibernate? How???
Thanks.
-oxyale
|