@Test public void testCreate() throws Exception { createEntity(1L, "h1", "global", "v1"); }
@Transactional public void create(HostConfigMapping hostConfigMapping) { populateCache(); entityManagerProvider.get().persist(buildHostConfigMappingEntity(hostConfigMapping)); Long hostId = hostConfigMapping.getHostId(); if (hostId != null) { Set<HostConfigMapping> set; if (hostConfigMappingByHost.containsKey(hostId)) { set = hostConfigMappingByHost.get(hostId); } else { set = new HashSet<HostConfigMapping>(); hostConfigMappingByHost.put(hostId, set); } set.add(hostConfigMapping); } }
HostConfigMappingDAO { @Transactional public void create(HostConfigMapping hostConfigMapping) { populateCache(); entityManagerProvider.get().persist(buildHostConfigMappingEntity(hostConfigMapping)); Long hostId = hostConfigMapping.getHostId(); if (hostId != null) { Set<HostConfigMapping> set; if (hostConfigMappingByHost.containsKey(hostId)) { set = hostConfigMappingByHost.get(hostId); } else { set = new HashSet<HostConfigMapping>(); hostConfigMappingByHost.put(hostId, set); } set.add(hostConfigMapping); } } }
HostConfigMappingDAO { @Transactional public void create(HostConfigMapping hostConfigMapping) { populateCache(); entityManagerProvider.get().persist(buildHostConfigMappingEntity(hostConfigMapping)); Long hostId = hostConfigMapping.getHostId(); if (hostId != null) { Set<HostConfigMapping> set; if (hostConfigMappingByHost.containsKey(hostId)) { set = hostConfigMappingByHost.get(hostId); } else { set = new HashSet<HostConfigMapping>(); hostConfigMappingByHost.put(hostId, set); } set.add(hostConfigMapping); } }  }
HostConfigMappingDAO { @Transactional public void create(HostConfigMapping hostConfigMapping) { populateCache(); entityManagerProvider.get().persist(buildHostConfigMappingEntity(hostConfigMapping)); Long hostId = hostConfigMapping.getHostId(); if (hostId != null) { Set<HostConfigMapping> set; if (hostConfigMappingByHost.containsKey(hostId)) { set = hostConfigMappingByHost.get(hostId); } else { set = new HashSet<HostConfigMapping>(); hostConfigMappingByHost.put(hostId, set); } set.add(hostConfigMapping); } }  @Transactional void create(HostConfigMapping hostConfigMapping); @Transactional HostConfigMapping merge(HostConfigMapping hostConfigMapping); @RequiresSession Set<HostConfigMapping> findByType(final long clusterId, Long hostId, final String type); @RequiresSession HostConfigMapping findSelectedByType(final long clusterId,
      Long hostId, final String type); @RequiresSession Set<HostConfigMapping> findSelected(final long clusterId, Long hostId); @RequiresSession Set<HostConfigMapping> findSelectedByHosts(Collection<Long> hostIds); @RequiresSession Map<String, List<HostConfigMapping>> findSelectedHostsByTypes(final long clusterId,
                                                                             Collection<String> types); @RequiresSession List<HostConfigMappingEntity> findAll(); @Transactional void removeByHostId(Long hostId); @Transactional void removeByClusterAndHostName(final long clusterId, String hostName); HostConfigMappingEntity buildHostConfigMappingEntity(HostConfigMapping hostConfigMapping); HostConfigMapping buildHostConfigMapping(
      HostConfigMappingEntity hostConfigMappingEntity); }
HostConfigMappingDAO { @Transactional public void create(HostConfigMapping hostConfigMapping) { populateCache(); entityManagerProvider.get().persist(buildHostConfigMappingEntity(hostConfigMapping)); Long hostId = hostConfigMapping.getHostId(); if (hostId != null) { Set<HostConfigMapping> set; if (hostConfigMappingByHost.containsKey(hostId)) { set = hostConfigMappingByHost.get(hostId); } else { set = new HashSet<HostConfigMapping>(); hostConfigMappingByHost.put(hostId, set); } set.add(hostConfigMapping); } }  @Transactional void create(HostConfigMapping hostConfigMapping); @Transactional HostConfigMapping merge(HostConfigMapping hostConfigMapping); @RequiresSession Set<HostConfigMapping> findByType(final long clusterId, Long hostId, final String type); @RequiresSession HostConfigMapping findSelectedByType(final long clusterId,
      Long hostId, final String type); @RequiresSession Set<HostConfigMapping> findSelected(final long clusterId, Long hostId); @RequiresSession Set<HostConfigMapping> findSelectedByHosts(Collection<Long> hostIds); @RequiresSession Map<String, List<HostConfigMapping>> findSelectedHostsByTypes(final long clusterId,
                                                                             Collection<String> types); @RequiresSession List<HostConfigMappingEntity> findAll(); @Transactional void removeByHostId(Long hostId); @Transactional void removeByClusterAndHostName(final long clusterId, String hostName); HostConfigMappingEntity buildHostConfigMappingEntity(HostConfigMapping hostConfigMapping); HostConfigMapping buildHostConfigMapping(
      HostConfigMappingEntity hostConfigMappingEntity);  }