public void init() {
    data = socialHistoryTypeCodeRepository.findAll();

    if (data.size() == 0) {
      SocialHistoryTypeCode code = new SocialHistoryTypeCode();
      code.setCode("code");
      code.setDisplayName("displayName");

      data.add(code);
      socialHistoryTypeCodeRepository.save(code);
    }
  }
 public SocialHistoryTypeCode getRandomSocialHistoryTypeCode() {
   init();
   SocialHistoryTypeCode obj = data.get(rnd.nextInt(data.size()));
   String code = obj.getCode();
   return socialHistoryTypeCodeRepository.findByCode(code);
 }