Package org.sonatype.mavenbook.ch03

Examples of org.sonatype.mavenbook.ch03.BasicCRUDIT


      // entity manager because they share the same underlying connection object.
      // When trace is on, you'll see the SOAP requests and responses on stdout.
      connector.getConnection().getConfig().setTraceMessage(true);
      connector.getConnection().getConfig().setPrettyPrintXml(true);

      MyEntity entity = new MyEntity();
      entity.setName("A Test Entity");

      entityService.save(entity);
     
      assertNotNull(entity.getId());
      entityId = entity.getId();

      entity = entityService.findEntity(entityId);
     
      assertEquals("A Test Entity", entity.getName());
     
      entity.setName("A Modified Test Entity");
     
      entityService.save(entity);

      entity = entityService.findEntity(entityId);
     
      assertEquals("A Modified Test Entity",entity.getName());

      entityService.delete(entityId);
     
      entity = entityService.findEntity(entityId);
     
View Full Code Here


  public MyEntity findEntity(String id) {

    // Uncomment when you have defined your entity
    //
    if("new".equals(id)) {
      return new MyEntity();
    } else {
      return em.find(MyEntity.class, id);
    }
    
    // ...meanwhile here's a fake entity (remove this when the real one is ready)
View Full Code Here

  }
 
  @Transactional
  public boolean delete(String entityId) {
    MyEntity entity = em.find(MyEntity.class, entityId);
    if(entity==null) {
      return false;
    }
    em.remove(entity);
    return true;
View Full Code Here

TOP

Related Classes of org.sonatype.mavenbook.ch03.BasicCRUDIT

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.