@Override public Long getNextAddressId() { logger.debug("Obtaining next address id"); Long maxId = HunterHibernateHelper.getMaxEntityIdAsNumber(HunterAddress.class, Long.class, "id"); maxId = maxId == null ? 1 : maxId + 1; logger.debug("Successfully obtained next address Id >> " + maxId); return maxId; }