I am specifically looking for JPA code generation technique
First, what are all the project could generate JPA compliant code? (Eg. HibernateTools)
Second, I
Please have a look on JOOQ.
http://www.jooq.org/
Open Source is available .....
Minuteproject is a generator tool and can generate JPA1/ JPA2 as well as hibernate ORM-like artifacts. It is based on reverse-engineering from the database. You can instruct the generator to apply convention for your java code that do not follow your DB convention, but the mapping will be correct. (Example strip DB name prefix; table starting with ADMIN_ such as ADMIN_ENVIRONMENT are Environment (w/out Admin) as java class) For the moment there 20+ conventions that help you reshape your model to be less DB look-and-feel by more Java-OO-friendly.
Another interesting feature is updatable-code enabling to modify both the generated code and your model AND aht the next generation your modifications will be kept! The generator makes the merge.
The templates are opensource and work with velocity, it is 'quite' easy to append a track to make specific one for your framework (ex security aspects... that are relevant to your organisation). You can scope your template to field level, entity (table or view), package (group of entities), model, application providing flexibility, and since the template of a track knows each other via metadata it is quite easy to reference then from other templates and to associate them by configuration with naming convention.
check out JPM2java, Its a code generator for JPA. The only catch is it does not generate JPA code from SQL files or table, you'd need a orm.xml file. If you are looking for a tool to generate code directly from tables, you may want to try Netbeans. It has options to generate JPA code directly from tables
Open source graphical tool to generate JPA class, visualize & modify Database, reverse engineering exiting source code and import models from existing database.
For NetBeans : http://jpamodeler.github.io/
For Eclipse : https://www.eclipse.org/webtools/dali/