Package javax.persistence

Examples of javax.persistence.EntityManager.joinTransaction()


    getTransactionManager().commit();
    System.out.printf( "Writing %s took %sms ie %sns/entry\n", nbrOfBlogEntries,
        ( System.nanoTime() - start ) / 1000000, ( System.nanoTime() - start ) / ( nbrOfBlogEntries ) );

    getTransactionManager().begin();
    em.joinTransaction();
    em = getFactory().createEntityManager();
    int nbr_of_reads = 100000;
    start = System.nanoTime();
    for ( int i = 0; i < nbr_of_reads; i++ ) {
      int primaryKey = rand.nextInt( nbrOfBlogEntries - 1 ) + 1; // start from 1
View Full Code Here


    //public String addPerson(Person person, UserSignOn userSignOn){
    public String addPerson(Person person) {
        EntityManager em = emf.createEntityManager();
        try {
            utx.begin();
            em.joinTransaction();
            em.persist(person);
            utx.commit();
        } catch (Exception exe) {
            try {
                utx.rollback();
View Full Code Here

            friend.getIncomingInvitations().add(invitation);
            logger.finer("After: size of incomingInvitations for friend " + friend.getIncomingInvitations().size());

            logger.finer("**** ModelFacade::addFriend about to merge, person username=" + loggedInUser.getUserName() +
                    " and friend username=" + friend.getUserName());
            em.joinTransaction();
            loggedInUser = em.merge(loggedInUser);
            em.merge(friend);
            //Do we need to persist invite too?
            em.persist(invitation);
            utx.commit();
View Full Code Here

            strb.append(")");
            q = em.createQuery(strb.toString());
        }
        try {
            utx.begin();
            em.joinTransaction();
            em.persist(socialEvent);
            boolean needsMerge = false;

            List<SocialEventTag> ltags = null;
            if (q != null) {
View Full Code Here

        comment.setSocialEvent(null);

        EntityManager em = emf.createEntityManager();
        try {
            utx.begin();
            em.joinTransaction();
            comment = em.merge(comment);
            em.merge(event);
            em.remove(comment);
            utx.commit();
        } catch (Exception e) {
View Full Code Here

        }
        EntityManager em = emf.createEntityManager();
        // TO DO -- Look into bulk updates to improve performance
        try {
            utx.begin();
            em.joinTransaction();
            // Add the new tags
            SocialEventTag sTag;
            for (String tagStr : tagStrings) {
                sTag = new SocialEventTag(tagStr);
                sTag.getSocialEvents().add(event);
View Full Code Here

    public SocialEvent updateSocialEvent(SocialEvent event) {
        EntityManager em = emf.createEntityManager();
        try {
            utx.begin();
            em.joinTransaction();
            event = em.merge(event);
            utx.commit();
        } catch (Exception exe) {

            logger.severe("updateSocialEvent failed: " + exe.toString());
View Full Code Here

        EntityManager em = emf.createEntityManager();
        try {
            // persist data
            utx.begin();
            em.joinTransaction();
            cr = em.merge(cr);
            utx.commit();

        } catch (Exception exe) {
            try {
View Full Code Here

        EntityManager em = emf.createEntityManager();
        try {
            // persist data
            utx.begin();
            em.joinTransaction();
            cr = em.merge(cr);
            utx.commit();

        } catch (Exception exe) {
            try {
View Full Code Here

        //Person person = em.find(Person.class, username);
        Person person = findPerson(username);
        person.getIncomingInvitations().remove(inv);
        try {
            utx.begin();
            em.joinTransaction();
            Invitation inv0 = em.merge(inv);
            em.remove(inv0);
            utx.commit();
        } catch (Exception exe) {
            //exe.printStackTrace();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.