@Test public void testFindById() throws Exception { ResourceTypeEntity entity = new ResourceTypeEntity(); expect(entityManager.find(ResourceTypeEntity.class, 99)).andReturn(entity); replay(entityManager); ResourceTypeDAO dao = new ResourceTypeDAO(); dao.entityManagerProvider = entityManagerProvider; Assert.assertEquals(entity, dao.findById(99)); }
@RequiresSession public ResourceTypeEntity findById(Integer id) { return entityManagerProvider.get().find(ResourceTypeEntity.class, id); }
ResourceTypeDAO { @RequiresSession public ResourceTypeEntity findById(Integer id) { return entityManagerProvider.get().find(ResourceTypeEntity.class, id); } }
ResourceTypeDAO { @RequiresSession public ResourceTypeEntity findById(Integer id) { return entityManagerProvider.get().find(ResourceTypeEntity.class, id); }  }
ResourceTypeDAO { @RequiresSession public ResourceTypeEntity findById(Integer id) { return entityManagerProvider.get().find(ResourceTypeEntity.class, id); }  @RequiresSession ResourceTypeEntity findById(Integer id); @RequiresSession ResourceTypeEntity findByName(String name); @RequiresSession List<ResourceTypeEntity> findAll(); @Transactional void create(ResourceTypeEntity entity); @Transactional ResourceTypeEntity merge(ResourceTypeEntity entity); }
ResourceTypeDAO { @RequiresSession public ResourceTypeEntity findById(Integer id) { return entityManagerProvider.get().find(ResourceTypeEntity.class, id); }  @RequiresSession ResourceTypeEntity findById(Integer id); @RequiresSession ResourceTypeEntity findByName(String name); @RequiresSession List<ResourceTypeEntity> findAll(); @Transactional void create(ResourceTypeEntity entity); @Transactional ResourceTypeEntity merge(ResourceTypeEntity entity);  }