Java Reference
In-Depth Information
The previous screenshot shows a table named SEQUENCE with no
primary key. The reason this table exists in our schema is because Toplink
Essentials, the default JPA implementation included with GlassFish, by
default uses a primary key generation strategy of TABLE , and it requires
this table to be present in the schema for primary key generation to work
properly. The table default table name and column names for the table
used to generate primary keys can be overridden by explicitly specifying
a primary key generation of TABLE and using the @TableGenerator
annotation on the primary key of our entity. See http://java.
sun.com/javaee/5/docs/api/javax/persistence/
TableGenerator.html for details.
Recall from Chapter 5 that in order to interact with JPA entities, we need to write
some code to interact with EntityManager . When using NetBeans, it isn't necessary
to write this code directly, as NetBeans can generate Data Access Objects ( DAO s)
from existing JPA entities. These DAO's can be implemented as stateless session
beans; this way they can take advantage of EJB features, especially transactions.
 
Search WWH ::




Custom Search