Tools to automatically generate Daos
I'm not interested in Spring/JPA etc. I like straight up JDBC/ODBC.
I was wondering what are the good (actually production ready) tools to enable taking a database schema and generating objects/daos that fetch/update them? I am intersted in Java and C++. I am interested in ramping up more on C++ in order to get away from all of this Spring/Mav开发者_如何学Goen/Hibernate madness and stop abstracting abstraction. I'd like to get down to the code. I like how I can investigate a generated JDBC dao and understand what's going on with my particular transaction isolation level. I like actually being able to debug tricky deadlocks because I can understand simple JDBC code. That aside, I'm just looking for some good code generation tools for Java/C++ that make production quality Daos.
This is a great tool, but it only works with java. http://www.codefutures.com/products/firestorm/
By the way, why is it that the Dao/POJO/POCO model as prevalent in the C++ world. It makes understanding code so much easier!
You can try the Telosys code generator with the templates for native JDBC DAO. It's simple to use and everything is free.
It works from an existing database or from a simple text model. At the moment the templates are mainly for Java, Python and JavaScript, but you can customize existing templates in order to generate C/C++ DAO.
See http://www.telosys.org
And the templates for JDBC DAO available on GitHub : https://github.com/telosys-templates-v3
In our older applications we use a set of scripts which dump the MySQL database and use the schema as input for (templated) POJO's. That however is very much database dependent.
For me the advantage of using tools like Hibernate is the loose coupling with the database for the developer. You don't need to know all the database dialects; Hibernate does. Which is handy because or production servers run DB2, Oracle or MySQL and our Junit tests use SQLite which has a different syntax.
Hibernate also has excellent debugging facilities in the log file, so I don't really feel the pain of not understanding what happens:) Our managed EJB2 apps however are a pain :(
Why All the fuzz? You can convert a ResultSet into a Map and vice versa based ón the table meta-information at runtime. Easy, simple.
The advantages of a dedicated Engine first show when you need to scale, so keep it simple to you Can change it later if needed.
精彩评论