Migrate to Mousetech - Final
This commit is contained in:
parent
4f0ccdd3a2
commit
5eb3df20dc
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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<Car, Long> {
|
||||
}
|
|
@ -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<Car> cars;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
cars = carRepository.findAll();
|
||||
}
|
||||
|
||||
public List<Car> getCars() {
|
||||
return cars;
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user