Last change
on this file was e5fefbd, checked in by Anita Terziska <63020646+Nit4e@…>, 2 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | package com.example.medweb.repository.impl;
|
---|
2 |
|
---|
3 | import com.example.medweb.model.Termin;
|
---|
4 | import com.example.medweb.repository.TerminRepositoryCustom;
|
---|
5 | import org.springframework.context.annotation.Primary;
|
---|
6 | import org.springframework.stereotype.Component;
|
---|
7 |
|
---|
8 | import javax.persistence.EntityManager;
|
---|
9 | import javax.persistence.PersistenceContext;
|
---|
10 | import java.util.List;
|
---|
11 |
|
---|
12 |
|
---|
13 | @Primary
|
---|
14 | @Component("custom")
|
---|
15 | public class TerminRepositoryImpl implements TerminRepositoryCustom {
|
---|
16 |
|
---|
17 | @PersistenceContext
|
---|
18 | private EntityManager entityManager;
|
---|
19 |
|
---|
20 | @Override
|
---|
21 | public List<Termin> findAllByTerminId(Integer termin_id) {
|
---|
22 | return entityManager.createQuery("select o from Termin o where o.termin_id = :termin_id",
|
---|
23 | Termin.class).setParameter("termin_id", termin_id).getResultList();
|
---|
24 | }
|
---|
25 |
|
---|
26 | @Override
|
---|
27 | public Termin findByTerminId(Integer termin_id) {
|
---|
28 | return entityManager.createQuery("select o from Termin o where o.termin_id = :termin_id",
|
---|
29 | Termin.class).setParameter("termin_id", termin_id).setMaxResults(1).getSingleResult();
|
---|
30 | }
|
---|
31 |
|
---|
32 | @Override
|
---|
33 | public void deleteByTerminId(Integer termin_id) {
|
---|
34 | entityManager.createQuery("delete from Termin o where o.termin_id = :termin_id");
|
---|
35 | }
|
---|
36 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.