Generate Java class with JPA annotations from an SQL script
Anyone k开发者_Python百科now a tool for generating Java class with JPA annotations from an SQL script?
Batch process would be a plus since I have a large amount of sql objects.
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.
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.
If for whatever reason you can't install the target database, try with an H2 in memory database with the appropriate compatibility mode.
精彩评论