Java Reference
In-Depth Information
Notice that nowhere in the above code is the primary key property in the Customer
JPA entity set. Since we are not using automatic primary key generation, and we are
not explicitly setting the primary key value, our application will throw an exception
when attempting to persist an instance of the Customer JPA entity.
If we examine the GlassFish log in the NetBeans output window, we can see the
following line:
at com.ensode.nbbook.buggywebapp.controller.CustomerController.creat
The above line is telling us that an exception occurred on line 35 of . Therefore we need to pause our application's execution
just before that line is executed so that we can inspect the values of all relevant
variables at that point.
One central feature of debuggers is the ability to pause execution of the application
being debugged by adding breakpoints to it. When a line of code where a breakpoint
has been placed is about to be executed, the application pauses, allowing us to
inspect the values of all instance and method scoped variables in the class where the
breakpoint was placed. In NetBeans, placing a breakpoint in a line is very simple,
all we need to do is click on the left margin of the source editor right next to the line
where the breakpoint will be added, at this point the line will be highlighted in red
plus a red square icon will be placed in the left margin.
Search WWH ::

Custom Search