< Previous | Next >

 

Lesson 1.4: Create entity beans from the database tables

In this lesson you will learn how generate JPA entity beans from tables in the sample Derby database that you connected to in the previous lesson.

Before you begin, complete Lesson 1.3: Create a connection to a database.

 

Generate JPA entity beans

  1. Right-click the project and then click

    JPA Tools | Generate Entities.

  2. In the Database Connection window, ensure that the database connection that you created in the previous lesson is selected.

  3. For Schema, select

    SAMP from the drop-down list. If the drop-down list does not work, click

    Reconnect and then try selecting the SAMP schema again. Click Next.

  4. On the Generate Entities from Tables page, type employee.list in the Package field.

  5. On the same page, select

    Synchronize classes in persistence.xml.

  6. In the Tables list, select

    Department and

    Employee and then click Finish.

    The package employee.list is created and populated with two entities, Employee.java and Department.java.

 

Lesson checkpoint

You have completed Lesson 1.3. In this lesson, you learned how to generate JPA entity beans from tables in the sample Derby database.

< Previous | Next >