java Velocity用于根据mysql表生成类文件
如何生成基于mysql数据库表的java类文件?
我看过一些速度模板示例,但没有看到任何读取 mysql 数据库表并从中生成类文件的示例。
关键是获取表模式信息并循环遍历列等。
How can I generate java class files that are based on mysql database tables?
I have seen some velocity templating examples but nothing that reads a mysql db table and generates a class file from it.
The key is getting the table schema information and looping through the columns etc.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该使用 Telosys,这是一个基于 Velocity 的轻量级代码生成器。它正是您所需要的。
该生成器能够连接到您的数据库以创建“数据库模型”,然后您只需在此模型上应用模板即可生成代码(通常是 DAO、CRUD 屏幕等)。
它可用于使用任何类型的技术(JDBC、JPA 等)生成 Java 持久层,
请参阅 http://www .telosys.org/ 及其“数据库模型”http://www.telosys.org/models.html
GitHub 上提供了一些现成的模板。请参阅:http://www.telosys.org/templates.html,
https://github.com/telosys-templates-v3
You should use Telosys, a lightweight code generator based on Velocity. It does exactly what you need.
This generator is able to connect to your database to create a "Database model" then you just have to apply templates on this model to generate your code (typically DAO, CRUD Screens, etc).
It can be used to generate a Java persistence layer with any kind technology ( JDBC, JPA, etc )
See http://www.telosys.org/ and its "Database model" http://www.telosys.org/models.html
Some ready to use templates are available on GitHub. See : http://www.telosys.org/templates.html,
https://github.com/telosys-templates-v3