我在 Eclipse Luna (4.4.1) 的 JBoss7 上部署了一个 JPA 项目。
我已在服务器中定义了一个数据源,并在我的 persistence.xml
文件中引用了它:
<jta-data-source>java:/testdb</jta-data-source>
我从头开始创建了一个实体 bean,一切都运行良好。但是...是否有任何 Eclipse 工具、外部插件或其他连接到数据库、读取表并自动生成此类实体的工具?
我设法通过使用本地 JDBC 连接来做到这一点,但现在我找不到使用 jta 数据源来做到这一点的方法。
最佳答案
我在您的帖子中没有看到任何有关 Hibernate 的内容,但您可以查看 Hibernate Tools对您的 POJO 进行逆向工程。它应该做到这一点。
来自文档:
The most powerful feature of Hibernate Tools is a database reverse engineering tool that can generate domain model classes and Hibernate mapping files, annotated EJB3 entity beans, HTML documentation or even an entire JBoss Seam application in seconds!
关于java - Eclipse 中的 JPA 项目 : how to auto-generate entity classes from DB tables,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29222452/