@Override
    public Optional<NotificationPreferenceEntity> getNotificationPreferenceByUserIdAndType(String userId, NotificationType notificationType) {
        TypedQuery<NotificationPreferenceEntity> query = getActiveEntityManager()
             .createQuery(
                  "SELECT pref "
                       + "FROM NotificationPreferenceEntity pref "
                       + "WHERE pref.user.username = :userId "
                       + "AND pref.type = :notificationType",
                     NotificationPreferenceEntity.class
             )
             .setParameter("userId", userId)
             .setParameter("notificationType", notificationType);
        return super.getOne(query);
    }
Storage for simple notifications system

@author Marc Savy {@literal <marc@blackparrotlabs.io>}
manager/api/jpa/src/main/java/io/apiman/manager/api/jpa/NotificationRepositoryImpl.java