code: static User findByKey(final EntityManager em, final String userId)
      {
          User user = em.find(User.class, userId);
          logger.info("[On Find by key]");
          System.out.println("#######################START##########################################");
          logger.info("\n");
          logger.info("\t\t User's first name:" + user.getFirstName());
          logger.info("\t\t User's emailId:" + user.getEmailId());
          logger.info("\t\t User's Personal Details:" + user.getPersonalDetail().getName());
          logger.info("\t\t User's Personal Details:" + user.getPersonalDetail().getPassword());
          logger.info("\t\t User's total tweets:" + user.getTweets().size());
          logger.info("\n");
          System.out.println("#######################END############################################");
          logger.info("\n");
          return user;
      }
docs: On find by user id.
  
  @param em         entity manager instance.
  @param userId     user id.