Java Reference
In-Depth Information
The
Local Variables
window can be opened by going to
Window
| Debugging | Local Variables
or by pressing
Alt+Shift+1
on
windows and Linux systems, and
Ctrl+Shift+1
on Mac OS X
systems.
By expanding the node corresponding to our
customer
object, we can see the values
of all of its properties. At this point we should notice that the
customerId
property
is null, which results in the code attempting to insert a new row with a null primary
key. At this point we have discovered the problem. Now that the problem is known,
fixing the code is trivial, in our example, the easiest way to fix it is to add the
@GeneratedValue
annotation to the
customerId
property of our entity bean.
Summary
In this appendix we covered how to debug enterprise applications using NetBeans,
we saw how NetBeans makes debugging remote applications deployed to an
application server as simple as debugging standard Java applications.
We also saw how we can add breakpoints to pause execution of our applications
and either step into or step over each line.
Additionally we saw how we can inspect the values of all variables in scope by
looking at the
Local Variables
window.