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%2...
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