[jdf-users] [jdf] Re: JBoss Developer Framework

Disqus notifications at disqus.net
Tue Feb 19 06:13:33 EST 2013



Pete Muir <> wrote, in response to mick:

Thanks mick, I've fixed this in master, so next time we do a release you should see this fixed :-D

User's website: http://twitter.com/plmuir
IP address: 94.174.205.64
Link to comment: http://redirect.disqus.com/url?url=http%3A%2F%2Fjboss.org%2Fjdf%2Fstage%2Fquickstarts%2Fjboss-as-quickstart%2Fguide%2FGreeterQuickstart%2F%23comment-804125108%3A8C2uxevldt3M8UTLBveOeVKsK74&impression=65c8495e-7a85-11e2-aa3c-00304834ba4a&type=notification.post.moderator&event=email&behavior=click

mick (unregistered) wrote:

Thank you for this very instructive tutorial.

But there is a little mistake in Method "getForUsername", because
the finally block executes commit() even in the case of an exception.

Please correct this part to:

public User getForUsername(String username) {
try {
User user;
            try {
                utx.begin();
                Query query = entityManager.createQuery("select u from User u where u.username = ?");
                query.setParameter(1, username);
                user = (User) query.getSingleResult();
            } catch (NoResultException e) {
                user = null;
            }
            utx.commit();
            return user;
 } catch (Exception e) { ...

The Method greet() should catch the Exception thrown in getForUsername:

public void greet() {
try { 
...

-----
Options: You can moderate through email. Respond in the body with "Delete". Reply with "Like" to like this comment, or respond with anything else to approve this comment and post your message as a reply comment.

Or use the moderate panel: http://jdf.disqus.com/admin/moderate/#/pending


Stop receiving notifications when new comments are posted:
http://disqus.com/account/#notifications
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jdf-users/attachments/20130219/736de127/attachment.html 


More information about the jdf-users mailing list