What to create your entity beans dynamically?
After you’ve created a new EJB Project in Eclipse and you have a database with tables, sequences, and relationships defined, it is quite easy to create your entity beans dynamically in Eclipse.
- Ensure that the JPS Tools are enabled.
- Right click the EJB Project folder and select properties
- On the left hand side of the properties window, select Project Facits
- Check the Java Persistence checkbox
- Build the beans from the database.
- Right click the EJB Project folder and select JPA Tools > Generate Entities from Tables...
- Ensure you are connected with the correct server and schema
- Select the entity beans you want in your project.
- Don't for get to tell it which package you want the beans in.
- Click next until it asks you for the sequences for each bean and enter in the appropriate sequence generators.
- Click finish and it will build all the entity beans for you.
The project will then build the beans for you assuming you have all the appropriate relationships etc.
Resources: Kent Jackson (BYU-Idaho Professor)
(Configuration: Eclipse Galileo for Java EE 6 using JBoss Server on Mac OS X 10.6 connecting to a VMware virtual machine with Windows running an academic licence version of Oracle)