tell me more icon In the IDE

When you complete the steps for creating entities from tables, JDeveloper displays messages in the EJB Log window:

EJB log window

The Application Navigator should look similar to the following when all the folders in the project are expanded:

Application Navigator

The project now contains these components:

  • persistence.xml: A metadata file that declares that a JAR file is a JPA persistence archive. In the metadata, one or more persistence units may be defined. Select persistence.xml in the Application Navigator. In the Structure window, notice the default persistence unit that was automatically generated by JDeveloper.
  • ProductsBase.java: The EJB-JPA entity that represents the PRODUCTS_BASE table in the FOD schema.

If you double-click ProductsBase.java, it will open in the source editor. By default, JDeveloper uses annotations in Java source files for the JPA mapping model. Among the generated annotations notice the following:

  • The @NamedQuery annotation, which is used for each named query. JDeveloper automatically generates a findAll named query for you, which is useful for testing. You will use this named query later.
  • The @Id annotation specifies that the following field is a primary key.
  • The @Column annotations specify the characteristics of database table columns.

If you created entities from tables that have a master-detail relationship, other generated annotations may include:

  • The @OneToMany annotation, which specifies that the entity participates in a one-to-many relationship.
  • The @ManyToOne and @JoinColumn annotations, which specify the details of the master-detail relationship.

Copyright © 1997, 2009, Oracle. All rights reserved.

false ,,,,,,,,,,,,,,,