| 1 | package info.ahlberg.spring.service; |
| 2 | |
| 3 | import java.util.List; |
| 4 | |
| 5 | import info.ahlberg.spring.dao.ContactDAO; |
| 6 | import info.ahlberg.spring.domain.Contact; |
| 7 | |
| 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | import org.springframework.stereotype.Service; |
| 10 | import org.springframework.transaction.annotation.Transactional; |
| 11 | |
| 12 | @Service |
| 13 | public class ContactServiceImpl implements ContactService { |
| 14 | @Autowired |
| 15 | private ContactDAO contactDAO; |
| 16 | |
| 17 | @Override |
| 18 | public List<Contact> findAll() { |
| 19 | return contactDAO.loadAll(); |
| 20 | } |
| 21 | |
| 22 | @Override |
| 23 | @Transactional |
| 24 | public void save(Contact contact) { |
| 25 | contactDAO.persist(contact); |
| 26 | } |
| 27 | |
| 28 | } |
| 29 | |