that previous example code was too complex... phew it was a late night
this a simpler example of the a method that does a rollback when a
NoResultException is thrown.
even if the exception is handled it doesnt matter the txn is rollback and no
commits are done.
if the NoResultException is NOT thrown the method commits correctly.
is this voodoo or something?
@Transactional( propagation=Propagation.NOT_SUPPORTED)
public void txnMethod( Collection<Long> list) throws
ApplicationExecption{
for (Iterator<Long> iterator = list.iterator(); iterator.hasNext();)
{
Long fbId = iterator.next();
PositionUser user = null;
final Query query =
em.createNamedQuery(PositionUser.FIND_BY_FB_ID);
query.setParameter("facebookId", fbId);
try {
user = (PositionUser) query.getSingleResult();
}
catch (NoResultException e) {
log.info( "error occured:" + e.toString() );
}catch (NonUniqueResultException e) {
throw new ApplicationExecption(e);
}
if(user!= null) {
user.setAccuracy(5000);
em.merge(user);
}
}
}
--
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en.