4
|
1 package de.comline.spring.service;
|
|
2
|
|
3 import javax.transaction.Transactional;
|
|
4
|
|
5 import org.springframework.beans.factory.annotation.Autowired;
|
|
6 import org.springframework.stereotype.Service;
|
|
7
|
|
8 import de.comline.spring.entity.Movie;
|
|
9 import de.comline.spring.repository.MovieRepository;
|
|
10
|
|
11 @Service
|
|
12 public class MovieService {
|
|
13 @Autowired
|
|
14 private MovieRepository repository;
|
|
15
|
|
16 @Transactional
|
|
17 public Movie createMovie(String title) {
|
|
18 Movie movie = new Movie(title);
|
|
19 movie = repository.save(movie);
|
|
20 return movie;
|
|
21 }
|
|
22 }
|