FeaturesPluginsDocs & SupportCommunityPartners

Persistence UI Specification

Author: Jan Rojcek

$Revision: 1.14 $
$Date: 2008/01/22 15:54:38 $

Table of Contents:

Use Cases and Scenarios

Create Enterprise Application with Persistence

The user just downloaded NetBeans IDE to try new Java persistence. He wants to create an enterprise application with web and EJB modules.

The user is already using new version of NetBeans IDE and wants to create another enterprise application with persistence from scratch.

Scenario:

  • In New Enterprise Application Wizard, the user selects Java EE 5 version, which is the default if the selected server supports it. In this scenario, the IDE does not create persistence unit.
  • Detailed steps TBD

Create EJB Module with Persistence

The user has an enterprise application and wants to create a new EJB module with new Java persistence and add it to the enterprise application.

The user wants to create a new standalone EJB module with new Java persistence.

Scenario:

  • In New EJB Module Wizard, the user selects Java EE 5 version, or the enterprise application this module will be part of already has Java EE 5 version set. No persistence unit will be created during this scenario.
  • Detailed steps TBD

Create Web Module with Persistence

The user has an enterprise application and wants to create a new web module with new Java persistence and add it to the enterprise application.

The user wants to create a new standalone web module with new Java persistence.

Scenario:

  • In New Web Application Wizard, the user selects Java EE 5 version, or the enterprise application this module will be part of already has Java EE version set. No persistence unit will be created during this scenario.
  • Detailed steps TBD

Create Java SE Application with Persistence

The user just downloaded NetBeans IDE to try new Java persistence. He wants to create a java application.

The user is already using new version of NetBeans IDE and wants to create another Java SE application with persistence from scratch.

Scenario:

  • In this scenario, the IDE doesn't create persistence unit. The user just goes through the regular Java Application wizard. No persistence related steps are in this scenario.
  • Detailed steps TBD

Create Entity Class

The user has an application (EJB module, Web module, Java app or library) with no entity classes in it. She/he wants to create a new class that will be persisted in application server.

The user already has some entity classes in their app. She/he wants to create another entity class that will be persisted the same way as the existing entity classes.

Scenario:

  • In New Entity Class Wizard, the user defines basic persistence unit attributes. In the subsequent scenario, the user doesn't modify persistence unit properties.
  • Detailed steps TBD

Create Entity Classes from Database

The user has an application (EJB module, Web module, Java app or library) with no entity classes in it. She/he wants to generate entity classes from existing database tables.

The user already has some entity classes in their app. She/he wants to generate other entity classes that will be persisted the same way as the existing entity classes.

Scenario:

  • In Entity Classes from Database Wizard (Step 2, Step 3), the user defines basic persistence unit attributes. In the subsequent scenario, the user doesn't modify persistence unit attributes.
  • Detailed steps TBD

Convert to Entity Class

The user has an application (EJB module, Web module, Java app or library) with no entity classes in it. She/he wants to make an existing class persistent in database.

The user already has some entity classes in their app. She/he wants to persist another class the same way as the existing entity classes.

Scenario 1:

  • The user uses Convert to Entity Class Dialog. In the dialog, the user defines basic persistence unit attributes. In the subsequent scenario, the user doesn't modify persistence unit properties.
  • Detailed steps TBD
Scenario 2:
  • The user types @Entity in the source code. A persistence unit hint offers the user to create persistence unit.
  • Detailed steps TBD

Specification

Source Menu

Figure: Source Menu

| Source |
----------
Override Methods...
Convert to Entity Class...
Fix Imports
Surround with try-catch
------------------------------
Reformat Code
Shift Left
Shift Right
Comment
Uncomment
------------------------------
Insert Next Matching Word
Insert Previous Matching Word
------------------------------

New Project Wizard

New Enterprise Application - Name and Location (Step 2)

Figure: Name and Location wizard panel
+---------------------------------------------------------------------------------+
| New Enterprise Application                                                      |
+---------------------------------------------------------------------------------+
| Name and Location                                                               |
| ------------------------------------------------------------------------------- |
|                                                                                 |
| Project Name:     |_EnterpriseApplication_____________________________________| |
|                                                                                 |
| Project Location: |_/users/me___________________________________| [ Browse... ] |
| Project Folder:   |_/users/me/EnterpriseApplication___________________________| |
|                                                                                 |
| ------------------------------------------------------------------------------- |
|                                                                                 |
| Server:           |_Glassfish_______________________________________________v_| |
| Java EE Version:  |_Java EE 5______v_|                                          |
|                                                                                 |
| [x] Create EJB Module:             |_EnterpriseApplication-EJBModule__________| |
| [x] Create Web Application Module: |_EnterpriseApplication-WebModule__________| |
|                                                                                 |
|                                                                                 |
| [x] Set as Main Project                                                         |
|                                                                                 |
|                             [ Back ]    Next>  [[ Finish ]] [ Cancel ] [ Help ] |
+---------------------------------------------------------------------------------+

Figure: Server combo when no server is registered

Server: |__________________________________________v_|
        |                                            | - empty item
        |--------------------------------------------|
        | Add Server...                              |
        | Manage Servers...                          |
        +--------------------------------------------+

Figure: Server combo with 2 servers registered

Server: |__________________________________________v_|
        | Glassfish                                  |
        | Sun Java System Application Server 8       |
        |--------------------------------------------|
        | Add Server...                              |
        | Manage Servers...                          |
        +--------------------------------------------+

Figure: Java EE Version combo

Java EE Version: |__________________________________________v_|
                 | Java EE 5                                  |
                 | J2EE 1.4                                   |
                 | J2EE 1.3                                   |
                 +--------------------------------------------+

Components:

  • Server combo box - contains always all registered severs that can handle enterprise applications. The servers are not filtered based on the value selected in the Java EE Version combo. The initial values is Glassfish or SJSAS 8 if registered. If not, then any server is selected initially. Next time the wizard uses the recent values.
  • Java EE Version combo box - contains all version numbers supported by selected server in the Server combo box. If the user selects a server that doesn't support the current version number, the Version combo automatically switches to the highest supported version number.

New EJB Module - Name and Location (Step 2)

Figure: Name and Location of EJB Module

+---------------------------------------------------------------------------------+
| New EJB Module                                                                  |
+---------------------------------------------------------------------------------+
| Name and Location                                                               |
| ------------------------------------------------------------------------------- |
|                                                                                 |
| Project Name:     |_EJBModule1________________________________________________| |
|                                                                                 |
| Project Location: |_/users/me___________________________________| [ Browse... ] |
| Project Folder:   |_/users/me/EJBModule1______________________________________| |
|                                                                                 |
| ------------------------------------------------------------------------------- |
|                                                                                 |
| Add to Enterprise Application: |_EnterpriseApp______________________________v_| |
|                                                                                 |
| Server:           |_Glassfish_______________________________________________v_| |
| Java EE Version:  |_Java EE 5_____v_|                                           |
|                                                                                 |
|                                                                                 |
| [x] Set as Main Project                                                         |
|                                                                                 |
|                             [ Back ]    Next>  [[ Finish ]] [ Cancel ] [ Help ] |
+---------------------------------------------------------------------------------+

New Web Application - Name and Location (Step 2)

Figure: Name and Location of Web Application

+---------------------------------------------------------------------------------+
| New Web Application                                                             |
+---------------------------------------------------------------------------------+
| Name and Location                                                               |
| ------------------------------------------------------------------------------- |
|                                                                                 |
| Project Name:     |_WebApplication____________________________________________| |
|                                                                                 |
| Project Location: |_/users/me___________________________________| [ Browse... ] |
| Project Folder:   |_/users/me/WebApplication__________________________________| |
|                                                                                 |
| ------------------------------------------------------------------------------- |
|                                                                                 |
| Add to Enterprise Application: |_EnterpriseApp______________________________v_| |
|                                                                                 |
| Server:           |_Glassfish_______________________________________________v_| |
| Java EE Version:  |_Java EE 5_________v_|                                       |
|                                                                                 |
| Context Path:     |_/WebApplication___________________________________________| |
| Source Structure: |_Java BluePrints___v_|                                       |
|                                                                                 |
|                                                                                 |
| [x] Set as Main Project                                                         |
|                                                                                 |
|                             [ Back ] [[ Next> ]] [ Finish ] [ Cancel ] [ Help ] |
+---------------------------------------------------------------------------------+

New File Wizard (Step 1)

Choose File Type in Java EE 5 (Step 1)

Figure: File Type categories in Java EE 5 EJB Module Project

Enterprise
  Session Bean
  Message-Driven Bean
  Service Locator
  Caching Service Locator
  Standard Deployment Descriptor
Java Classes
JavaBeans Objects
JUnit
Persistence
  Entity Class
  Entity Classes from Database
  Session Beans from Entity Classes
  Persistence Unit
  Database Schema
Web Services
Server Resources
XML
Ant Build Scripts
Other

Figure: File Type categories in Java EE 5 Web Application Project

Web
  JSP
  Servlet
  Filter
  Web Application Listener
  Tag Library Descriptor
  Tag File
  Tag Handler
  HTML
  XHTML
  JSF Managed Bean
  Struts Action
  Struts ActionForm Bean
  Service Locator
  Caching Service Locator
Java Classes
JavaBeans Objects
JUnit
Persistence
  Entity Class
  Entity Classes from Database
  JSF Pages from Entity Classes
  Persistence Unit
  Database Schema
Web Services
Server Resources
XML
Ant Build Scripts
Other
Note: I moved Service Locator templates into the Web category.

Choose File Type in J2EE 1.4 (Step 1)

Figure: File Type categories in J2EE 1.4 EJB Module Project running on Java SE 5

Enterprise
  Session Bean
  Entity Bean
  CMP Entity Beans from Database
  Message-Driven Bean
  Service Locator
  Caching Service Locator
Java Classes
JavaBeans Objects
JUnit
Persistence
  Entity Class
  Entity Classes from Database
  Persistence Unit
  Database Schema
Web Services
Server Resources
XML
Ant Build Scripts
Other

Figure: File Type categories in J2EE 1.4 Web Application Project running on Java SE 5

Web
  JSP
  Servlet
  Filter
  Web Application Listener
  Tag Library Descriptor
  Tag File
  Tag Handler
  HTML
  XHTML
  JSF Managed Bean
  Struts Action
  Struts ActionForm Bean
  Service Locator
  Caching Service Locator
Java Classes
JavaBeans Objects
JUnit
Persistence
  Entity Class
  Entity Classes from Database
  JSF Pages from Entity Classes
  Persistence Unit
  Database Schema
Web Services
Server Resources
XML
Ant Build Scripts
Other
Note: I moved Service Locator templates into the Web category.

Figure: File Type categories in J2EE 1.4 EJB Module Project running on J2SE 1.4

Enterprise
  Session Bean
  Entity Bean
  CMP Entity Beans from Database
  Message-Driven Bean
  Service Locator
  Caching Service Locator
Java Classes
JavaBeans Objects
JUnit
Persistence
  Database Schema
Web Services
Server Resources
XML
Ant Build Scripts
Other

Figure: File Type categories in J2EE 1.4 Web Application Project running on J2SE 1.4

Web
  JSP
  Servlet
  Filter
  Web Application Listener
  Tag Library Descriptor
  Tag File
  Tag Handler
  HTML
  XHTML
  JSF Managed Bean
  Struts Action
  Struts ActionForm Bean
  Service Locator
  Caching Service Locator
Java Classes
JavaBeans Objects
JUnit
Persistence
  Database Schema
Web Services
Server Resources
XML
Ant Build Scripts
Other
Note: I moved Service Locator templates into the Web category.

Choose File Type in Java SE (Step 1)

Figure: File Type categories in Java SE 5 Java Application/Library Project

Java Classes
Java GUI Forms
JavaBeans Objects
JUnit
Persistence
  Entity Class
  Entity Classes from Database
  Persistence Unit
  Database Schema
Web Services
XML
Ant Build Scripts
Other

Figure: File Type categories in J2SE 1.4 Java Application/Library Project

Java Classes
Java GUI Forms
JavaBeans Objects
JUnit
Persistence
  Database Schema
Web Services
XML
Ant Build Scripts
Other

New File Wizard (Step 2, ...)

New Entity Class - Name and Location (Step 2)

Figure: Name and Location of Entity Class

+---------------------------------------------------------------------------------+
| New Entity Class                                                                |
+---------------------------------------------------------------------------------+
| Name and Location                                                               |
| ------------------------------------------------------------------------------- |
|                                                                                 |
| Entity Name: |_EntityClass____________________________________________________| |
|                                                                                 |
| Project:     |_Module6Ejb_____________________________________________________| |
| Location:    |_Source Packages_______________________________________________v| |
| Package:     |_com.acme______________________________________________________v| |
|                                                                                 |
| ------------------------------------------------------------------------------- |
|                                                                                 |
| Primary Key Type: |_int__________|_v_|                                          |
|                                                                                 |
| {w} There is no persistence unit in project yet. You need persistence unit to   |
|     persist entity classes.                                                     |
|     [ Create Persistence Unit... ]                                              |
|                                                                                 |
|                                                                                 |
|                             [ Back ]    Next>  [[ Finish ]] [ Cancel ] [ Help ] |
+---------------------------------------------------------------------------------+

Figure: Primary Key Type combo

Primary Key Type: |___________________________|_v_|
                  | com.myapp.Key                 |
                  | com.myapp.IntKey              |
                  | int                           |
                  | long                          |
                  | ??? - what else               |
                  +-------------------------------+

Components:

  • Primary Key Type editable combo box - initially contains the list of primitive types suitable for primary key and recent items (10 items). When the user starts typing the list starts offering the "code completion" items. Have a look at the main combo box in web browsers.
  • {w} - warning icon, warning and Create Persistence Unit... button appear only if there is not a persistence unit in project yet. The button opens up Create Persistence Unit Dialog.

New Entity Classes from Database - Database Tables (Step 2)

Figure: Database tables for entity classes in Java EE 5 projects

+---------------------------------------------------------------------------------+
| New Entity Classes from Database                                                |
+---------------------------------------------------------------------------------+
| Database Tables                                                                 |
| ------------------------------------------------------------------------------- |
|                                                                                 |
| (o) Data Source:         |_jdbc/default_____________________________________v_| |
| ( ) Database Schema:     |_MyApplication/src/petstore.dbschema______________v_| |
|                                                                                 |
| Available Tables:                                 Selected Tables:              |
| +-----------------------------+                   +---------------------------+ |
| | ACCOUNT_TBL (no primary key)|                   | CAR_TBL                   | |
| | CUSTOMER_TBL                |                   | BIKE_TBL                  | |
| | MANUFACTURE_TBL             |                   | FUEL_TBL                  | |
| | PRODUCT_TBL (class Product) |                   | PASSENGER_TBL             | |
| | TBL_233 (join table)        | [     Add >     ] |                           | |
| |                             | [   < Remove    ] |                           | |
| |                             |                   |                           | |
| |                             | [  Add All >>   ] |                           | |
| |                             | [ << Remove All ] |                           | |
| |                             |                   |                           | |
| |                             |                   |                           | |
| |_____________________________|                   |___________________________| |
|                                                   [x] Include Related Tables    |
|                                                                                 |
|                                                                                 |
|                             [ Back ] [[ Next> ]]   Finish   [ Cancel ] [ Help ] |
+---------------------------------------------------------------------------------+

Figure: Database tables for entity classes in Java SE project

+---------------------------------------------------------------------------------+
| New Entity Classes from Database                                                |
+---------------------------------------------------------------------------------+
| Database Tables                                                                 |
| ------------------------------------------------------------------------------- |
|                                                                                 |
| (o) Database Connection: |_jdbc:pointbase://localhost:9002/sample___________v_| |
| ( ) Database Schema:     |_MyApplication/src/petstore.dbschema______________v_| |
|                                                                                 |
| Available Tables:                                 Selected Tables:              |
| +-----------------------------+                   +---------------------------+ |
| | ACCOUNT_TBL (no primary key)|                   | CAR_TBL                   | |
| | CUSTOMER_TBL                |                   | BIKE_TBL                  | |
| | MANUFACTURE_TBL             |                   | FUEL_TBL                  | |
| | PRODUCT_TBL (class Product) |                   | PASSENGER_TBL             | |
| | TBL_233 (join table)        | [     Add >     ] |                           | |
| |                             | [   < Remove    ] |                           | |
| |                             |                   |                           | |
| |                             | [  Add All >>   ] |                           | |
| |                             | [ << Remove All ] |                           | |
| |                             |                   |                           | |
| |                             |                   |                           | |
| |_____________________________|                   |___________________________| |
|                                                   [x] Include Related Tables |
|                                                                                 |
|                                                                                 |
|                             [ Back ] [[ Next> ]]   Finish   [ Cancel ] [ Help ] |
+---------------------------------------------------------------------------------+

Figure: Data Source Combo

Data Source: |_____________________________v_|
             | jdbc/__default                |
             | jdbc/MyDatabase               |
             |-------------------------------|
             | New Data Source...            |
             +-------------------------------+

Figure: Database Connection Combo

Database Connection: |__________________________________________v_|
                     | jdbc:derby://localhost:1527/sample         |
                     | jdbc:derby://localhost:1527/myDatabase     |
                     |--------------------------------------------|
                     | New Database Connection...                 |
                     +--------------------------------------------+

Components:

  • Data Source combo - contains all data sources from the target application server. Clicking the New Data Source... item brings up New Data Source Dialog.
  • Database Connection combo - contains all registered JDBC connections. Clicking the New Database Connection item brings up New Database Connection Wizard.
  • Available Tables list - contains all tables from the selected database. Following items are gray (the Add buttons are disabled if selected):
    • items without primary key - marked with label (no primary key). The tooltip shows There is no primary key in table. Cannot create entity class for such table.
    • items already mapped to any class in the project (in any package) - marked with label class <class-name>. The tooltip shows up the fully qualified class name Already mapped to <package.class-name>. Cannot create 2 entity classes for 1 table..
    • items representing a join table - marked with label (join table). The tooltip shows This is a join table. Cannot create entity class for join table.
  • Selected Tables list - contains the list of selected tables. The related tables are gray. They appear in the list only if Include Related Tables check box is checked. The gray items have tooltip Table referenced by SOME_TABLE or Join table of TABLE1 and TABLE2. Remove buttons are disabled if a related table is selected in the list.
  • Include Related Tables check box - initially checked. If checked, related tables of all items added to the selected tables list appear also in the list of selected tables. The related items are displayed in gray. If unchecked, all related items either made available (turned from gray to black) or are removed from the selected list, depending on whether they had been added manually by the user or automatically because of the Include Related Tables check box.

New Entity Classes from Database - Entity Classes (Step 3)

Figure: Entity class names

+---------------------------------------------------------------------------------+
| New Entity Classes from Database                                                |
+---------------------------------------------------------------------------------+
| Entity Classes                                                                  |
| ------------------------------------------------------------------------------- |
|                                                                                 |
| Specify the names and the location of the entity classes.                       |
|                                                                                 |
| Class Names: |______Database Table_______|_____________Class Name_____________| |
|              | BIKE_TBL                  | BikeTbl                            | |
|              | CAR_TBL                   | CarTbl                             | |
|              | FUEL_TBL                  | FuelTbl                            | |
|              | PASSENGER_TBL             | PassengerTbl                       | |
|              |________________________________________________________________| |
|                                                                                 |
| Project:     |_Module6Ejb_____________________________________________________| |
| Location:    |_Source Packages_______________________________________________v| |
| Package:     |_com.acme______________________________________________________v| |
|                                                                                 |
| [x] Generate Named Query Annotations for Persistent Fields                      |
|                                                                                 |
| {w} There is no persistence unit in project yet. You need persistence unit to   |
|     persist entity classes.                                                     |
|     [ Create Persistence Unit... ]                                              |
|                                                                                 |
|                                                                                 |
|                             [ Back ] [[ Next> ]]   Finish   [ Cancel ] [ Help ] |
+---------------------------------------------------------------------------------+

Components:

  • Class Names table - contains read-only database table names and editable class names. The class names are generated automatically for each database table. The user can modify the generated name.
  • Generate Named Query Annotations for Persistent Fields check box - if checked annotations for named queries will be generated for each entity class.
  • {w} - warning icon, warning and Create Persistence Unit... button appear only if there is not a persistence unit in project yet. The button opens up Create Persistence Unit Dialog.

New Persistence Unit (Step 2)

Figure: New Persistence Provider wizard in Java EE 5 project

+---------------------------------------------------------------------------------+
| New Persistence Unit                                                            |
+---------------------------------------------------------------------------------+
| Provider and Database                                                           |
| ------------------------------------------------------------------------------- |
|                                                                                 |
| Persistence Unit Name:     |_NewPersistenceUnit_______________________________| |
|                                                                                 |
| Specify the persistence provider and persistence database.                      |
|                                                                                 |
| Persistence Provider:      |________________________________________________v_| |
| Data Source:               |________________________________________________v_| |
| [x] Use Java Transaction APIs                                                   |
|                                                                                 |
| Table Generation Strategy: (o) Create ( ) Drop and Create ( ) None              |
|                                                                                 |
|                                                                                 |
|                             [ Back ]    Next>  [[ Finish ]] [ Cancel ] [ Help ] |
+---------------------------------------------------------------------------------+

Figure: New Persistence Provider wizard in Java SE project

+---------------------------------------------------------------------------------+
| New Persistence Unit                                                            |
+---------------------------------------------------------------------------------+
| Provider and Database                                                           |
| ------------------------------------------------------------------------------- |
|                                                                                 |
| Persistence Unit Name:     |_NewPersistenceUnit_______________________________| |
|                                                                                 |
| Specify the persistence provider and persistence database.                      |
|                                                                                 |
| Persistence Library:       |________________________________________________v_| |
| Database Connection:       |________________________________________________v_| |
|                                                                                 |
| Table Generation Strategy: (o) Create ( ) Drop and Create ( ) None              |
|                                                                                 |
|                                                                                 |
|                             [ Back ]    Next>  [[ Finish ]] [ Cancel ] [ Help ] |
+---------------------------------------------------------------------------------+

Components: see Create Persistence Unit Dialog.

New JSF Pages from Entity Classes - Entity Classes (Step 2)

Figure: Create PU and Select Entity Classes

+----------------------------------------------------------------------------------+
| New JSF from Entity Classes                                                      |
+----------------------------------------------------------------------------------+
| Entity Classes                                                                   |
| -------------------------------------------------------------------------------- |
|                                                                                  |
| Available Entity Classes:                         Selected Entity Classes:       |
| +-----------------------------+                   +----------------------------+ |
| | Customer (org.myapplication.|                   | Order  (org.myapplication.o| |
| | DiscountCode (org.myapplicat|                   | ProductType  (org.myapplica| |
| | Manufacture (org.myapplicati|                   | Product  (org.myapplication| |
| |                             |                   |                            | |
| |                             | [     Add >     ] |                            | |
| |                             | [   < Remove    ] |                            | |
| |                             |                   |                            | |
| |                             | [  Add All >>   ] |                            | |
| |                             | [ << Remove All ] |                            | |
| |                             |                   |                            | |
| |                             |                   |                            | |
| +-----------------------------+                   +----------------------------+ |
|                                                   [x] Include Referenced Classes |
|                                                                                  |
| {e} There is no persistence unit in project yet. You need persistence unit to    |
|     persist entity classes.                                                      |
|     [ Create Persistence Unit... ]                                               |
|                                                                                  |
|                             [ Back ] [[ Next> ]]   Finish    [ Cancel ] [ Help ] |
+----------------------------------------------------------------------- ----------+ 

Components:

  • The left list will display all entity classes in all persistence units in application.
  • The Create PU button is an error, not a warning like in Entity wizard. PU is required for the JSF pages to work.
  • Include Referenced Classes: if checked any classes referenced by selected classes will also be moved to the right side when adding or moved back when removing classes.

New JSF Pages from Entity Classes - Generated JSF Pages and Classes (Step 3)

Figure: Select Location of JSF pages and controller classes

+----------------------------------------------------------------------------------+
| New JSF from Entity Classes                                                      |
+----------------------------------------------------------------------------------+
| Generated JSF Pages and Classes                                                  |
| -------------------------------------------------------------------------------- |
|                                                                                  |
| Specify the location of new JSF  pages.                                          |
|                                                                                  |
| JSF Pages Folder: |_/___________________________________________|  [ Browse... ] |
|                                                                                  |
|                                                                                  |
| Specify the location of new JSF controller classes and JSF converters.           |
|                                                                                  |
| Project:       |_Module6Ejb____________________________________________________| |
| Location:      |_Source  Packages_____________________________________________v| |
| Package:       |_com.acme_____________________________________________________v| |
| Created Files: <ClassName>Controller and <ClassName>Converter for each entity    |
|                class.                                                            |
|                                                                                  |
|                                                                                  |
|                             [ Back ]    Next>   [[ Finish ]] [ Cancel ] [ Help ] |
+----------------------------------------------------------------------- ----------+

Figure: Browse Folder dialog

+-------------------------------------------+
| Browse Folder                             |
+-------------------------------------------+
| Folders:                                  |
| +---------------------------------------+ |
| | [a] My Web Module                     | |
| |  - [f] Web Pages                      | |
| |     + [f] WEB-INF                     | |
| |     + [f] myFolder                    | |
| |                                       | |
| |                                       | |
| |                                       | |
| |                                       | |
| |                                       | |
| |                                       | |
| |                                       | |
| +---------------------------------------+ |
| [ New Folder... ]                         |
|                                           |
|                       [[ OK ]] [ Cancel ] |
+-------------------------------------------+

Components:

  • JSF Pages Folder Browse button opens up a tree file chooser in project titled Browse Folder with OK and Cancel buttons.

New Session Beans from Entity Classes - Entity Classes (Step 2)

Figure: Create PU and Select Entity Classes

+----------------------------------------------------------------------------------+
| New Session Beans from Entity Classes                                            |
+----------------------------------------------------------------------------------+
| Entity Classes                                                                   |
| -------------------------------------------------------------------------------- |
|                                                                                  |
| Available Entity Classes:                         Selected Entity Classes:       |
| +-----------------------------+                   +----------------------------+ |
| | Customer (org.myapplication.|                   | Order  (org.myapplication.o| |
| | DiscountCode (org.myapplicat|                   | ProductType  (org.myapplica| |
| | Manufacture (org.myapplicati|                   | Product  (org.myapplication| |
| |                             |                   |                            | |
| |                             | [     Add >     ] |                            | |
| |                             | [   < Remove    ] |                            | |
| |                             |                   |                            | |
| |                             | [  Add All >>   ] |                            | |
| |                             | [ << Remove All ] |                            | |
| |                             |                   |                            | |
| |                             |                   |                            | |
| +-----------------------------+                   +----------------------------+ |
|                                                   [x] Include Referenced Classes |
|                                                                                  |
| {e} There is no persistence unit in project yet. You need persistence unit to    |
|     persist entity classes.                                                      |
|     [ Create Persistence Unit... ]                                               |
|                                                                                  |
|                             [ Back ] [[ Next> ]]   Finish    [ Cancel ] [ Help ] |
+----------------------------------------------------------------------- ----------+ 

Components:

  • The left list will display all entity classes in all persistence units in application.
  • The Create PU button is an error, not a warning like in Entity wizard. PU is required for the Session beans to work.
  • Include Referenced Classes: if checked any classes referenced by selected classes will also be moved to the right side when adding or moved back when removing classes.

New Session Beans from Entity Classes - Generated Session Beans (Step 2)

Figure: Select location of session beans

+----------------------------------------------------------------------------------+
| New Session Beans from Entity Classes                                            |
+----------------------------------------------------------------------------------+
| Generated Session Beans                                                          |
| -------------------------------------------------------------------------------- |
|                                                                                  |
| Specify the location of new session beans.                                       |
|                                                                                  |
| Project:       |_Module6Ejb____________________________________________________| |
| Location:      |_Source  Packages_____________________________________________v| |
| Package:       |_com.acme_____________________________________________________v| |
| Created Files: <ClassName>Facade, <ClassName>Local for each entity class.        |
|                                                                                  |
| Create Interface:                                                                |
|   [ ] Remote                                                                     |
|   [x] Local                                                                      |
|                                                                                  |
|                                                                                  |
|                             [ Back ]    Next>   [[ Finish ]] [ Cancel ] [ Help ] |
+----------------------------------------------------------------------- ----------+

Components:

  • The Created Files label is dynamic depending on the selected Create Interface radio buttons.

New Standard Deployment Descriptor - Name and Location (Step 2)

Figure: Confirm name and location of descriptor

+----------------------------------------------------------------------------------+
| New Standard Deployment Descriptor                                               |
+----------------------------------------------------------------------------------+
| Name and Location                                                                |
| -------------------------------------------------------------------------------- |
|                                                                                  |
| Confirm the name and location of new deployment descriptor.                      |
|                                                                                  |
| Descriptor Name: |_ejb-jar.xml_________________________________________________| |
|                                                                                  |
| Project:         |_Module6Ejb__________________________________________________| |
| Location:        |_Configuration Files_________________________________________| |
| Created Files:   |_/home/me/myproject/Module6Ejb/src/conf/ejb-jar.xml__________| |
|                                                                                  |
|                                                                                  |
|                                                                                  |
|                                                                                  |
|                                                                                  |
|                             [ Back ]    Next>   [[ Finish ]] [ Cancel ] [ Help ] |
+----------------------------------------------------------------------- ----------+

Components:

  • All components are non-editable text fields.
  • If the descriptor already exists, the inline error says: Deployment descriptor already exists.

Create Persistence Unit Dialog

Figure: Dialog for creating a persistence unit in Java EE 5 project

+------------------------------------------------------------------------------+
| Create Persistence Unit                                                      |
+------------------------------------------------------------------------------+
|                                                                              |
| Specify the persistence provider and database for persisting entity classes. |
|                                                                              |
| Persistence Provider:      |_____________________________________________v_| |
| Data Source:               |_____________________________________________v_| |
| [x] Use Java Transaction APIs                                                |
|                                                                              |
| Table Generation Strategy: (o) Create ( ) Drop and Create ( ) None           |
|                                                                              |
|                                                                              |
|                                                      [[ Create ]] [ Cancel ] |
+------------------------------------------------------------------------------+

Figure: Dialog for adding a persistence unit in Java SE project

+------------------------------------------------------------------------------+
| Create Persistence Unit                                                      |
+------------------------------------------------------------------------------+
|                                                                              |
| Specify the persistence provider and database for persisting entity classes. |
|                                                                              |
| Persistence Library:       |_____________________________________________v_| |
| Database Connection:       |_____________________________________________v_| |
|                                                                              |
| Table Generation Strategy: (o) Create ( ) Drop and Create ( ) None           |
|                                                                              |
|                                                                              |
|                                                      [[ Create ]] [ Cancel ] |
+------------------------------------------------------------------------------+

Figure: Persistence Provider Combo

Persistence Provider: |_____________________________v_|
                      | TopLink (Default)             |
                      | Hibernate                     |
                      +-------------------------------+

Figure: Data Source Combo

Data Source: |_____________________________v_|
             | jdbc/__default                |
             | jdbc/MyDatabase               |
             |-------------------------------|
             | New Data Source...            |
             +-------------------------------+

Figure: Persistence Library Combo

Persistence Library: |_____________________________v_|
                     | Hibernate                     |
                     | Spring                        |
                     |-------------------------------|
                     | New Persistence Library...    |
                     | Manage Libraries...           |
                     +-------------------------------+

Figure: Database Connection Combo

Database Connection: |__________________________________________v_|
                     | jdbc:derby://localhost:1527/sample         |
                     | jdbc:derby://localhost:1527/myDatabase     |
                     |--------------------------------------------|
                     | New Database Connection...                 |
                     +--------------------------------------------+

Components:

  • Persistence Provider combo - contains all persistence providers registered on the application server.
  • Data Source combo - contains all data sources from the target application server. Clicking the New Data Source... item brings up New Data Source Dialog.
  • Persistence Library combo - contains all libraries from library manager that implement PersistenceManager. The New Persistence Library... item brings up the New Persistence Library Dialog. The Manage Library... item opens up the Library Manger dialog (Tools | Library Manager).
  • Database Connection combo - contains all registered JDBC connections. Clicking the New Database Connection item brings up New Database Connection Wizard.

New Data Source Dialog

Figure: Dialog for creating a data source

+------------------------------------------------------------------------------+
| New Data Source                                                              |
+------------------------------------------------------------------------------+
|                                                                              |
| Data Source Name:    |_NewDataSource_______________________________________| |
|                                                                              |
| Database Connection: |___________________________________________________v_| |
|                                                                              |
|                                                                              |
|                                                      [[ Create ]] [ Cancel ] |
+------------------------------------------------------------------------------+

Figure: Database Connection Combo

Database Connection: |__________________________________________v_|
                     | jdbc:derby://localhost:1527/sample         |
                     | jdbc:derby://localhost:1527/myDatabase     |
                     |--------------------------------------------|
                     | New Database Connection...                 |
                     +--------------------------------------------+

Components:

  • Database Connection combo - contains all registered JDBC connections. Clicking the New Database Connection item brings up New Database Connection Wizard.

New Persistence Library Dialog

Figure: New Persistence Library dialog

+------------------------------------------------------------------------------+
| New Persistence Library                                                      |
+------------------------------------------------------------------------------+
|                                                                              |
| Library Name: |_Hibernate__________________________________________________| |
|                                                                              |
|  ___________  __________  __________                                         |
| / Classes   \/ Sources  \/ Javadoc  \                                        |
| |            \-------------------------------------------------------------+ |
| | Library Classpath:                                                       | |
| | +------------------------------------------------+                       | |
| | | C:\libs\hibernate\hibernate.jar                | [ Add JAR/Folder... ] | |
| | | C:\libs\hibernate\other-hibernate.jar          |                       | |
| | |                                                | [       Remove      ] | |
| | |                                                |                       | |
| | |                                                | [      Move Up      ] | |
| | |                                                | [     Move Down     ] | |
| | |                                                |                       | |
| | |                                                |                       | |
| | +------------------------------------------------+                       | |
| |                                                                          | |
| +--------------------------------------------------------------------------+ |
|                                                                              |
| {e} PersistenceProvider is not present on library classpath.                 |
|                                                      [[ Create ]] [ Cancel ] |
+------------------------------------------------------------------------------+

Components:

  • For basic description of dialog, see Library Manager in Java SE Project Spec. The differences are:
  • Library Name text field is editable. Initially contains unique name NewLibrary (or NewLibrary1, NewLibrary2, etc.) which is selected.
  • Create button is disabled if (with associated inline errors):
    • No library name is specified - Specify library name.
    • No classpath item is specified - No warning in this case.
    • There is a classpath item but there isn't a PersistenceProvider on classpath - PersistenceProvider is not present on library classpath.
    • There is a classpath item but there isn't EntityManager on classpath - EntityManager is not present on library classpath.

New Database Connection Wizard - Database Connection (Step 1)

Figure: Wizard for creating a new database connection

+------------------------------------------------------------------------------+
| New Database Connection                                                      |
+------------------------------------------------------------------------------+
| Database Connection                                                          |
| ---------------------------------------------------------------------------- |
|                                                                              |
| Database Driver Library: |_______________________________________________v_| |
| Database Driver Class:   |_______________________________________________v_| |
|                                                                              |
| Database URL:   |________________________________________________________v_| |
|                                                                              |
| User Name:      |_________________________|                                  |
| Password:       |_________________________|                                  |
|                                                                              |
|                                                                              |
| Connecting to Database...                                                    |
| |///////////////////////__________________________________________| [ Stop ] |
|                                                                              |
|                                                                              |
|                          [ Back ]   [[ Next> ]]  Finish  [ Cancel ] [ Help ] |
+------------------------------------------------------------------------------+

Figure: Database Driver Library combo

Database Driver Library: |________________________________v_|
                         | JDBC-ODBC Bridge                 |
                         | Apache Derby                     |
                         |----------------------------------|
                         | New Driver Library...            |
                         | Manage Libraries...              |
                         +----------------------------------+

Components:

  • Database Driver Library combo - contains all libraries from library manager that implement Driver class. The New Database Driver Library... item brings up the New Database Driver Library Dialog. The Manage Library... item opens up the Library Manger dialog (Tools | Library Manager).
  • Connecting to Database... progress - shows up after clicking the Next button. When visible, all components are disabled except the progress bar and Stop and Cancel buttons. When the connection is established the wizard moves automatically to the next step. If the user clicks the Stop button the progress bar disappears and all components are enabled.

New Database Connection Wizard - Database Schema (Step 2)

Figure: Wizard panel for selecting database schema

+------------------------------------------------------------------------------+
| New Database Connection                                                      |
+------------------------------------------------------------------------------+
| Database Schema                                                              |
| ---------------------------------------------------------------------------- |
|                                                                              |
| Database Schema: |_______________________________________________________v_| |
|                                                                              |
|                                                                              |
|                                                                              |
|                                                                              |
|                                                                              |
|                                                                              |
|                          [ Back ]    Next>  [[ Finish ]] [ Cancel ] [ Help ] |
+------------------------------------------------------------------------------+

New Database Driver Library Dialog

Figure: New Database Driver Library dialog

+------------------------------------------------------------------------------+
| New Database Driver Library                                                  |
+------------------------------------------------------------------------------+
|                                                                              |
| Library Name: |_NewDatabaseDriver__________________________________________| |
|                                                                              |
|  ___________  __________  __________                                         |
| / Classes   \/ Sources  \/ Javadoc  \                                        |
| |            \-------------------------------------------------------------+ |
| | Library Classpath:                                                       | |
| | +------------------------------------------------+                       | |
| | | C:\libs\oracle\oracle.jar                      | [ Add JAR/Folder... ] | |
| | | C:\libs\oracle\other-oracle.jar                |                       | |
| | |                                                | [       Remove      ] | |
| | |                                                |                       | |
| | |                                                | [      Move Up      ] | |
| | |                                                | [     Move Down     ] | |
| | |                                                |                       | |
| | |                                                |                       | |
| | +------------------------------------------------+                       | |
| |                                                                          | |
| +--------------------------------------------------------------------------+ |
|                                                                              |
| {e} Driver is not present on library classpath.                              |
|                                                      [[ Create ]] [ Cancel ] |
+------------------------------------------------------------------------------+

Components:

  • For basic description of dialog, see Library Manager in Java SE Project Spec. The differences are:
  • Library Name text field is editable. Initially contains unique name NewDatabaseDriver (or NewDatabaseDriver1, NewDatabaseDriver2, etc.) which is selected.
  • Create button is disabled if (with associated inline errors):
    • No library name is specified - Specify library name.
    • No classpath item is specified - No warning in this case.
    • There is a classpath item but there isn't a PersistenceManager on classpath - Driver is not present on library classpath.

Convert to Entity Class Dialog

Figure: Dialog for converting a class to entity class

+----------------------------------------------------------------+
| Convert to Entity Class                                        |
+----------------------------------------------------------------+
|                                                                |
| Fields to Persist:                                             |
| +------------------------------------------------------------+ |
| |[x] name String                                             | |
| |[ ] address com.myapp.Address                               | |
| |[x] phone String                                            | |
| |                                                            | |
| |                                                            | |
| |                                                            | |
| |                                                            | |
| |____________________________________________________________| |
|                                                                |
| Primary Key:      |_int id_________________________________v_| |
|                                                                |
| {w} There is no persistence unit in project yet. You need      |
|     persistence unit to persist entity classes.                |
|     [ Create Persistence Unit... ]                             |
|                                                                |
|                                                                |
|                                       [[ Convert ]] [ Cancel ] |
+----------------------------------------------------------------+

Figure: Primary Key combo

Primary Key Field: |_int id_________________________________v_|
                   | String name                              |
                   | String phone                             |
                   | New Primary Key Field...                 |
                   +------------------------------------------+

Components:

  • Fields to Persist - contains the list of all fields in the class. Initially the "basic-type" items are selected.
  • Primary Key Field combo box - contains the list of all fields applicable for primary key. The New Primary Key Field... item brings up the New Primary Key Field Dialog.
  • {w} - warning icon, warning and Create Persistence Unit... button appear only if there is not a persistence unit in project yet. The button opens up Create Persistence Unit Dialog.
  • Convert button is disabled if (with associated inline errors):
    • No primary key is selected - Specify primary key.

New Primary Key Field Dialog

Figure: Dialog for creating new field acceptable for primary key

+-----------------------------------------------------------------+
| New Primary Key Field                                           |
+-----------------------------------------------------------------+
|                                                                 |
| Field Name:       |_id________________________________________| |
| Primary Key Type: |_long__________________________________|_v_| |
|                                                                 |
|                                         [[ Create ]] [ Cancel ] |
+-----------------------------------------------------------------+

Figure: Primary Key Type combo

Primary Key Type: |___________________________|_v_|
                  | com.myapp.Key                 |
                  | com.myapp.IntKey              |
                  | int                           |
                  | long                          |
                  | ??? - what else               |
                  +-------------------------------+

Components:

  • Field Name text field - initially contains unique name id (or id1, id2, etc.).
  • Primary Key Type editable combo box - initially contains the list of primitive types suitable for primary key and recent items (10 items). When the user starts typing the list starts offering the "code completion" items. Have a look at the main combo box in web browsers.
  • Create button is disabled if (with associated inline errors):
    • No field name is specified - Specify field name.
    • Type not applicable for primary key is specified - <selected-type> cannot be used for primary key.

Persistence Hint

Figure: Editor showing up the light bulb ($) on the same line as @Entity

  |
$ |  @Entity
  |  public class Customer {
  |  ...

Figure: Persistence hint

+----------------------------------------+
| Create Persistence Unit in Project...  |
+----------------------------------------+

Project Window

Figure: Project window showing location of entity classes and persistence.xml

+-----------------------------------------------------+
| Window Title                                        |
+-----------------------------------------------------+
| [a] EJB Module                                      |
|  - [f] Source Packages                              |
|     - [p] com.mycompany.myapp.ejbmodule             |
|         + [e] EntityClass                           |
|         + [c] Class                                 |
|  + [f] Test Packages                                |
|  + [f] Web Services (optional)                      |
|  + [f] Server Resources (optional)                  |
|  - [f] Configuration Files                          |
|     + [m] MANIFEST.MF                               |
|     + [x] persistence.xml                           |
|  + [f] Libraries                                    |
|  + [f] Test Libraries                               |
| [a] Web Module                                      |
|  + [f] Web Pages                                    |
|  - [f] Source Packages                              |
|     - [p] com.mycompany.myapp.webmodule             |
|         + [e] EntityClass                           |
|         + [c] Class                                 |
|  + [f] Test Packages                                |
|  + [f] Web Services (optional)                      |
|  + [f] Server Resources (optional)                  |
|  - [f] Configuration Files                          |
|     + [m] MANIFEST.MF                               |
|     + [x] persistence.xml                           |
|  + [f] Libraries                                    |
|  + [f] Test Libraries                               |
| [a] Java Application                                |
|  - [f] Source Packages                              |
|     - [p] META-INF                                  |
|         + [m] MANIFEST.MF                           |
|         + [x] persistence.xml                       |
|     - [p] com.mycompany.myapp.javamodule            |
|         + [e] EntityClass                           |
|         + [c] Class                                 |
|  + [f] Test Packages                                |
|  + [f] Libraries                                    |
|  + [f] Test Libraries                               |
|                                                     |
+-----------------------------------------------------+
[e] - entity class icon
[c] - class icon
[x] - persistence icon

New Contextual Menu in Java EE 5 Projects

Figure: New contextual menu in Java EE 5 EJB Module Project

New >
  File/Folder...
  -----------------------------
  Session Bean...
  Message-Driven Bean...
  Java Class...
  Java Package...
  Entity Class...
  Entity Classes from Database...
  Session Beans from Entity Classes...
  Web Service...

Figure: New contextual menu in Java EE 5 Web Application Project

New >
  File/Folder...
  -----------------------------
  JSP...
  HTML...
  Servlet...
  Java Class...
  Java Package...
  Entity Class...
  Entity Classes from Database...
  JSF Pages from Entity Classes...
  Web Service...
  Web Service Client...
  Folder...

New Contextual Menu in J2EE 1.4 Projects

Figure: New contextual menu in J2EE 1.4 EJB Module Project running on Java SE 5 or J2SE 1.4

New >
  File/Folder...
  -----------------------------
  Session Bean...
  Entity Bean...
  CMP Entity Beans from Database...
  Message-Driven Bean...
  Java Class...
  Java Package...
  Web Service...

Figure: New contextual menu in J2EE 1.4 Web Application Project running on Java SE 5 or J2SE 1.4

New >
  File/Folder...
  -----------------------------
  JSP...
  HTML...
  Servlet...
  Java Class...
  Java Package...
  Web Service...
  Web Service Client...
  Folder...

New Contextual Menu in Java SE Projects

Figure: New contextual menu in Java SE 5 Java Application/Library Project

New >
  File/Folder...
  -----------------------------
  Java Class...
  Java Interface...
  Java Package...
  JPanel Form...
  JFrame Form...
  Entity Class...
  Entity Classes from Database...
  Web Service...
  Web Service Client...

Figure: New contextual menu in J2SE 1.4 Java Application/Library Project

New >
  File/Folder...
  -----------------------------
  Java Class...
  Java Interface...
  Java Package...
  JPanel Form...
  JFrame Form...
  Web Service...
  Web Service Client...

Persistence Unit Editor

Figure: Persistence Unit editor

JSF Palette

JSF Form

Figure: Insert JSF Form dialog

+------------------------------------------------------------------------------+
| Insert JSF Form                                                              |
+------------------------------------------------------------------------------+
|                                                                              |
| (o) Empty Form                                                               |
| ( ) Form Generated from Entity Class                                         |
|     Entity Class: |__________________________________________| [ Browse... ] |
|     Form Fields:  (o) Editable  ( ) Read-only                                |
|                                                                              |
|                                                      [[ Insert ]] [ Cancel ] |
+------------------------------------------------------------------------------+

JSF Data Table

Figure: Insert JSF Data Table dialog

+------------------------------------------------------------------------------+
| Insert JSF Table                                                             |
+------------------------------------------------------------------------------+
|                                                                              |
| (o) Empty Table                                                              |
| ( ) Table Generated from Entity Class                                        |
|     Entity Class: |__________________________________________| [ Browse... ] |
|                                                                              |
|                                                      [[ Insert ]] [ Cancel ] |
+------------------------------------------------------------------------------+

Companion
Projects:
MySQL Database Server   Open JDK: an Open SourceJDK   GlassFish Community: an Open Source Application Server    Mobile & Embedded Community    Open Solaris   java.net - The Source for Java Technology Collaboration   Open ESB - The Open Enterprise Service Bus Powered by