diff --git a/src/main/java/com/codenotfound/primefaces/Car.java b/src/main/java/com/codenotfound/primefaces/Car.java deleted file mode 100644 index 4ccd6d9..0000000 --- a/src/main/java/com/codenotfound/primefaces/Car.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.codenotfound.primefaces; - -import java.io.Serializable; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; - -@Entity(name = "Car") -public class Car implements Serializable { - - private static final long serialVersionUID = 1L; - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Long id; - - private String brand; - - private int year; - - private String color; - - public Car() {} - - public Car(Long id, String brand, int year, String color) { - this.id = id; - this.brand = brand; - this.year = year; - this.color = color; - } - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getBrand() { - return brand; - } - - public void setBrand(String brand) { - this.brand = brand; - } - - public int getYear() { - return year; - } - - public void setYear(int year) { - this.year = year; - } - - public String getColor() { - return color; - } - - public void setColor(String color) { - this.color = color; - } -} diff --git a/src/main/java/com/codenotfound/primefaces/CarRepository.java b/src/main/java/com/codenotfound/primefaces/CarRepository.java deleted file mode 100644 index 65ad0ba..0000000 --- a/src/main/java/com/codenotfound/primefaces/CarRepository.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.codenotfound.primefaces; - -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.stereotype.Repository; - -@Repository -public interface CarRepository extends JpaRepository { -} diff --git a/src/main/java/com/codenotfound/primefaces/CarsView.java b/src/main/java/com/codenotfound/primefaces/CarsView.java deleted file mode 100644 index bdbc96b..0000000 --- a/src/main/java/com/codenotfound/primefaces/CarsView.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.codenotfound.primefaces; - -import java.io.Serializable; -import java.util.List; -import javax.annotation.PostConstruct; -import javax.faces.view.ViewScoped; -import javax.inject.Inject; -import javax.inject.Named; - -@Named -@ViewScoped -public class CarsView implements Serializable { - - private static final long serialVersionUID = 1L; - - @Inject - private CarRepository carRepository; - - private List cars; - - @PostConstruct - public void init() { - cars = carRepository.findAll(); - } - - public List getCars() { - return cars; - } -} diff --git a/src/main/java/com/mousetech/gourmetj/CategoryService.java b/src/main/java/com/mousetech/gourmetj/CategoryService.java index ada856d..646fe78 100644 --- a/src/main/java/com/mousetech/gourmetj/CategoryService.java +++ b/src/main/java/com/mousetech/gourmetj/CategoryService.java @@ -6,10 +6,13 @@ import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; import javax.inject.Named; +import org.springframework.transaction.annotation.Transactional; + import com.mousetech.gourmetj.persistence.model.Category; @Named @ApplicationScoped +@Transactional public class CategoryService implements Serializable { private static final long serialVersionUID = 1L; diff --git a/src/main/java/com/mousetech/gourmetj/SpringPrimeFacesApplication.java b/src/main/java/com/mousetech/gourmetj/SpringPrimeFacesApplication.java index 1b640ce..4f63e0f 100644 --- a/src/main/java/com/mousetech/gourmetj/SpringPrimeFacesApplication.java +++ b/src/main/java/com/mousetech/gourmetj/SpringPrimeFacesApplication.java @@ -3,10 +3,9 @@ package com.mousetech.gourmetj; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.domain.EntityScan; -import org.springframework.context.annotation.ComponentScan; @SpringBootApplication -@EntityScan(value = {"com.mousetech.gourmetj.persistence.model", "com.codenotfound.primefaces"}) +@EntityScan(value = {"com.mousetech.gourmetj.persistence.model"}) public class SpringPrimeFacesApplication { public static void main(String[] args) {