1 package se.citerus.dddsample.infrastructure.persistence.hibernate;
2
3 import org.springframework.stereotype.Repository;
4 import se.citerus.dddsample.domain.model.voyage.Voyage;
5 import se.citerus.dddsample.domain.model.voyage.VoyageNumber;
6 import se.citerus.dddsample.domain.model.voyage.VoyageRepository;
7
8
9
10
11 @Repository
12 public final class VoyageRepositoryHibernate extends HibernateRepository implements VoyageRepository {
13
14 public Voyage find(final VoyageNumber voyageNumber) {
15 return (Voyage) getSession().
16 createQuery("from Voyage where voyageNumber = :vn").
17 setParameter("vn", voyageNumber).
18 uniqueResult();
19 }
20
21 }