Package org.hibernate.test.cache.infinispan.functional

Examples of org.hibernate.test.cache.infinispan.functional.Contact


    try {
      Customer customer = new Customer();
      customer.setName( (id % 2 == 0) ? "JBoss" : "Red Hat" );
      Set<Contact> contacts = new HashSet<Contact>();

      Contact kabir = new Contact();
      kabir.setCustomer( customer );
      kabir.setName( "Kabir" );
      kabir.setTlf( "1111" );
      contacts.add( kabir );

      Contact bill = new Contact();
      bill.setCustomer( customer );
      bill.setName( "Bill" );
      bill.setTlf( "2222" );
      contacts.add( bill );

      customer.setContacts( contacts );

      Session s = openSession();
View Full Code Here


      Session session = sessionFactory.getCurrentSession();
      Customer customer = new Customer();
      customer.setName( "JBoss" );
      Set<Contact> contacts = new HashSet<Contact>();

      Contact kabir = new Contact();
      kabir.setCustomer( customer );
      kabir.setName( "Kabir" );
      kabir.setTlf( "1111" );
      contacts.add( kabir );

      Contact bill = new Contact();
      bill.setCustomer( customer );
      bill.setName( "Bill" );
      bill.setTlf( "2222" );
      contacts.add( bill );

      customer.setContacts( contacts );

      session.save( customer );
      tm.commit();

      IdContainer ids = new IdContainer();
      ids.customerId = customer.getId();
      Set contactIds = new HashSet();
      contactIds.add( kabir.getId() );
      contactIds.add( bill.getId() );
      ids.contactIds = contactIds;

      return ids;
    }
    catch (Exception e) {
View Full Code Here

      ids.customerId = customer.getId();
      Set<Contact> contacts = customer.getContacts();
      for ( Contact c : contacts ) {
        contactIds.add( c.getId() );
      }
      Contact contact = contacts.iterator().next();
      contacts.remove( contact );
      contactIds.remove( contact.getId() );
      ids.contactIds = contactIds;
      contact.setCustomer( null );

      session.save( customer );
      tm.commit();
      return ids;
    }
View Full Code Here

TOP

Related Classes of org.hibernate.test.cache.infinispan.functional.Contact

Copyright © 2018 www.massapicom. 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.