简体   繁体   English

使用SQL脚本中的JPA注释生成Java类

[英]Generate Java class with JPA annotations from an SQL script

Anyone know a tool for generating Java class with JPA annotations from an SQL script? 有人知道从SQL脚本生成带有JPA注释的Java类的工具吗?

Batch process would be a plus since I have a large amount of sql objects. 由于我有大量的sql对象,批处理将是一个加号。

The reverse engineering tools ( Hibernate Tools , OpenJPA's ReverseMappingTool , Eclipse Dali , etc) I'm aware of work against a database, not an SQL script - and this is actually what I would do: generate the schema from the script and then run the tool. 逆向工程工具( Hibernate Tools ,OpenJPA的ReverseMappingToolEclipse Dali等)我知道对数据库而不是SQL脚本的工作 - 这实际上就是我要做的事情:从脚本生成模式然后运行工具。

It should be pretty easy to automate this process (creating the schema, generating the entities, optionaly droping the schema) with Ant (Hibernate and OpenJPA provide an Ant task) or even a script. 使用Ant(Hibernate和OpenJPA提供Ant任务)甚至脚本自动执行此过程(创建模式,生成实体,可选地删除模式)应该非常容易。

If for whatever reason you can't install the target database, try with an H2 in memory database with the appropriate compatibility mode . 如果由于某种原因无法安装目标数据库,请尝试使用具有相应兼容模式的内存数据库中的H2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM