package de.oaa.xxx.session.entity;

import java.util.UUID;

import de.oaa.xxx.framework.AbstractDAO;
import jakarta.persistence.EntityManager;
import jakarta.persistence.TypedQuery;

public class SessionDAO extends AbstractDAO<SessionEntity> {

	public SessionDAO(EntityManager entityManager) {
		super(SessionEntity.class, entityManager);
	}

	public SessionEntity findByUserId(UUID userId) {
		TypedQuery<SessionEntity> query = getEntityManager().createQuery("select s from SessionEntity s where s.userId = :userId", SessionEntity.class);
		query.setParameter("userId", userId);
		return query.getSingleResult();
	}
}
