Hi,
Modifying Database Table Rows with the Java Persistence API
http://www.netbeans.org/kb/60/web/web-jpa-part2.htmlI must admit the article takes longer than 30 minutes and it's not for
faint-hearted ;-) I'd say 1 hour would be fine. It's not easy to
follow as there're less screenshots than one would expect. Sometimes I
didn't know what I should do and the screenshots helped me a couple of
times. More screenshots is something the article would benefit from.
As the article uses JPA in outside-the-container mode, I disagree with
the last sentence of the article: "When the page opens in the browser,
the display is very much like what you expect for an enterprise-level
application.". I wouldn't consider it an enterprise application when
JTA is not used when it's available for free and make the code leaner
and more readable. Just 0.02PLN.
The sample works fine.
Comments:
1/ Why is the document style of the article different than other
NetBeans articles? It doesn't look as part of the documentation set
(compare to Using Java Persistence API Within a Visual Web Application
-
http://www.netbeans.org/kb/60/web/web-jpa.html)
2/ Change
see the Support and Docs page on the NetBeans web site.
to
see the Docs & Support page on the NetBeans web site.
3/ The URL of "Using the Java Persistence API from a Visual Web
Application" in Article Prerequisites prerequisities is
http://testwww.netbeans.org/kb/60/web-jpa.html.
4/ Change "standard JSE project" to "standard Java SE project"
5/ Change "Similar to the addUser method" to "Similarly to the addUser method"
6/ The code in "Code Example 2: removeUser Method" should use
em.getReference(Users.class, users.getUserId()); not
em.find(Users.class, users.getUserId()); so some JPA providers can
optimize the load even further, besides lazy loading of relationships.
7/ Change "action handlers, we'll also" to "action handlers, we'll also"
8/ Add "Press OK" to "Customize Table Display Using Table Layout"
section after the column is set.
9/ Figure 6: Page1.jsp Displayed in Navigator Window shows Navigator
window with the JSP page in JSP tab whereas the text requested us to
change it to Design tab. Very confusing.
10/ Change "to see these properties in the Set bindable property
column." to "to see these properties in the Select bindable property
column."
11/ The snippet in "Code Example 10: Add Button Action Handler Method"
contains "private boolean updateRequest = false;" whereas the line was
requested to be added in "Code Example 9: Create Boolean Variables in
Page1.java". It's in "Code Example 11: Update Button Action Handler
Method" too.
12/ Remove
// TODO: Process the action. Return value is a navigation
// case name where null will return to the same page.
from "Code Example 14: Update Record Button Action Handler Method"
13/ Change
Right click TestWebApp in the Projects window and select Run Project.
to
Right click TestWebApp in the Projects window and select Run.
Jacek
--
Jacek Laskowski
http://www.JacekLaskowski.pl