Java Reference
In-Depth Information
Thankfully all of the steps described in the previous paragraph are automated
when using NetBeans with the bundled GlassFish application server. When using
this combination, all we need to do is open our Enterprise Application Project then
right-click on it and select Debug , at this point the application server is started in
debug mode (or restarted in debug mode if it was already running in standard
mode), the application is deployed and the debugger is automatically attached to
the application server.
We will use a simple application involving JSF, CDI, and JPA to illustrate NetBeans
debugging capabilities.
When persisting data in JPA entities, we either need to set the primary key explicitly
when inserting a new row in the database, or we need to set automatic primary
key generation using the @GeneratedValue annotation. In our example we will use
neither approach, this will make our application break when inserting new rows.
Here is the relevant code for the JPA entity:
package com.ensode.nbbook.buggywebapp.entitity;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
 
Search WWH ::




Custom Search