guys

in my JPA code a NoResultException causes the transaction to be rollback.

i am using the spring txn manger but all JPA methods are @Transactional( 
propagation=Propagation.NOT_SUPPORTED).


any help pls.


@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) {
                    List<Key> friends = user.getFriends();
                    PositionUser findUser = em.find(PositionUser.class, 
friends.get(0));
                    findUser.getFriends().remove(user.getKey());            
        
                    em.merge(findUser);            
                }
                em.remove(user);
            }
    }


-lp

-- 
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 google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to