java Velocity用于根据mysql表生成类文件

发布于 2025-01-01 00:06:31 字数 111 浏览 3 评论 0原文

如何生成基于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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

拿命拼未来 2025-01-08 00:06:31

您应该使用 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文