Java Reference
In-Depth Information
We can choose to do so or simply accept the default connection name. Once we have
created our new data source and connection pool, we can continue configuring our
persistence unit.
It is a good idea to leave the Use Java Transaction APIs checkbox checked. This will
instruct our JPA implementation to use the Java Transaction API ( JTA ) to allow the
application server to manage transactions. If we uncheck this box, we will need to
manually write code to manage transactions.
Most JPA implementations allow us to define a table generation strategy. We can
instruct our JPA implementation to create tables for our entities when we deploy
our application, to drop the tables and then regenerate them when our application
is deployed, or to not create any tables at all. NetBeans allows us to specify the table
generation strategy for our application by clicking on the appropriate value in the
Table Generation Strategy radio button group.
When working with a new application, it is a good idea to select
the Drop and Create table generation strategy in the wizard.
This will allow us to add, remove, and rename fields in our JPA
entity at will, without having to make the same changes in the
database schema. When selecting this table generation strategy,
tables in the database schema will be dropped and recreated
every time we deploy our application. Therefore, any data
previously persisted will be lost.
Search WWH ::

Custom Search