@Test public void copyUploadedEnrichmentTags() { Judgment ctJudgment = testPersistenceObjectFactory.createCtJudgment(); UploadEnrichmentTag uploadEnrichmentTag1 = TestInMemoryUploadEnrichmentTagFactory.createUploadEnrichmentTag(EnrichmentTagTypes.REFERENCED_COURT_CASES, "{\"caseNumber\":\"sss\"}", ctJudgment.getId(), new DateTime(2012, 12, 12, 11, 13)); UploadEnrichmentTag uploadEnrichmentTag2 = TestInMemoryUploadEnrichmentTagFactory.createUploadEnrichmentTag(EnrichmentTagTypes.REFERENCED_REGULATIONS, "{\"refReg\":\"11212ss\"}", ctJudgment.getId(), new DateTime(2012, 12, 12, 12, 11)); UploadEnrichmentTag uploadEnrichmentTag3 = TestInMemoryUploadEnrichmentTagFactory.createUploadEnrichmentTag(EnrichmentTagTypes.REFERENCED_REGULATIONS, "{\"refReg\":\"1121ss\"}", ctJudgment.getId()+1000, new DateTime(2012, 12, 11, 12, 11)); uploadEnrichmentTagRepository.save(Lists.newArrayList(uploadEnrichmentTag1, uploadEnrichmentTag2, uploadEnrichmentTag3)); assertEquals(0, enrichmentTagRepository.count()); uploadEnrichmentTagCopier.copyUploadedEnrichmentTags(); assertEquals(2, enrichmentTagRepository.count()); assertThat(enrichmentTagRepository.findAll(), containsInAnyOrder(transform(uploadEnrichmentTag1), transform(uploadEnrichmentTag2))); }
@Transactional public void copyUploadedEnrichmentTags() { Query query = entityManager.createNativeQuery("insert into enrichment_tag(id, creation_date, ver, judgment_id, tag_type, value)" + " (select nextval('seq_enrichment_tag'), creation_date, 0, uploadTag.judgment_id, uploadTag.tag_type, uploadTag.value from upload_enrichment_tag uploadTag" + " where exists (select judgment from judgment judgment where judgment.id = uploadTag.judgment_id))"); query.executeUpdate(); }
UploadEnrichmentTagCopier { @Transactional public void copyUploadedEnrichmentTags() { Query query = entityManager.createNativeQuery("insert into enrichment_tag(id, creation_date, ver, judgment_id, tag_type, value)" + " (select nextval('seq_enrichment_tag'), creation_date, 0, uploadTag.judgment_id, uploadTag.tag_type, uploadTag.value from upload_enrichment_tag uploadTag" + " where exists (select judgment from judgment judgment where judgment.id = uploadTag.judgment_id))"); query.executeUpdate(); } }
UploadEnrichmentTagCopier { @Transactional public void copyUploadedEnrichmentTags() { Query query = entityManager.createNativeQuery("insert into enrichment_tag(id, creation_date, ver, judgment_id, tag_type, value)" + " (select nextval('seq_enrichment_tag'), creation_date, 0, uploadTag.judgment_id, uploadTag.tag_type, uploadTag.value from upload_enrichment_tag uploadTag" + " where exists (select judgment from judgment judgment where judgment.id = uploadTag.judgment_id))"); query.executeUpdate(); }  }
UploadEnrichmentTagCopier { @Transactional public void copyUploadedEnrichmentTags() { Query query = entityManager.createNativeQuery("insert into enrichment_tag(id, creation_date, ver, judgment_id, tag_type, value)" + " (select nextval('seq_enrichment_tag'), creation_date, 0, uploadTag.judgment_id, uploadTag.tag_type, uploadTag.value from upload_enrichment_tag uploadTag" + " where exists (select judgment from judgment judgment where judgment.id = uploadTag.judgment_id))"); query.executeUpdate(); }  @Transactional void copyUploadedEnrichmentTags(); @Autowired void setEntityManager(EntityManager entityManager); }
UploadEnrichmentTagCopier { @Transactional public void copyUploadedEnrichmentTags() { Query query = entityManager.createNativeQuery("insert into enrichment_tag(id, creation_date, ver, judgment_id, tag_type, value)" + " (select nextval('seq_enrichment_tag'), creation_date, 0, uploadTag.judgment_id, uploadTag.tag_type, uploadTag.value from upload_enrichment_tag uploadTag" + " where exists (select judgment from judgment judgment where judgment.id = uploadTag.judgment_id))"); query.executeUpdate(); }  @Transactional void copyUploadedEnrichmentTags(); @Autowired void setEntityManager(EntityManager entityManager);  }