Java Reference
In-Depth Information
Clicking on the combo box reveals a cryptic, almost undecipherable (from the
users point of view anyway), label for our customer. The reason we see this label
is because the labels generated for each item in the combo box come from the
toString() method of the entities used to populate it. We can work around this
issue by modifying the toString() method so that it returns a user-friendly String
suitable to use as a label.
As we can see, the generated code from NetBeans wizards could certainly use some
tweaking, such as modifying the toString() methods of each JPA entity so that it
can be used as a label, modifying some of the property names on the entities so that
they make more sense to us developers, modifying the labels on the generated JSF
pages so that they are more user friendly. Nevertheless, as we can see we can have
a fully working application completely created by a few clicks of the mouse. This
functionality certainly saves us a lot of time and effort (just don't tell your boss
about it).
Summary
In this chapter, we saw the many ways in which NetBeans can help us speed up
development of applications taking advantage of the Java Persistence API (JPA).
We saw how NetBeans can generate new JPA classes with all required annotations
already in place.
Additionally, we covered how NetBeans can automatically generate code to persist a
JPA entity to a database table.
We also covered how NetBeans can generate JPA entities from an existing database
schema, including the automated generation of JPQL named queries.
Finally, we saw how NetBeans can generate a complete JSF application from existing
JPA entities.
 
Search WWH ::




Custom Search