Jennifer Chao 5 gadus atpakaļ
vecāks
revīzija
08060b8f24

+ 79
- 0
src/main/java/io/zipcoder/persistenceapp/Controller/HomeController.java Parādīt failu

@@ -0,0 +1,79 @@
1
+package io.zipcoder.persistenceapp.Controller;
2
+
3
+import io.zipcoder.persistenceapp.Model.Home;
4
+import io.zipcoder.persistenceapp.Model.Person;
5
+import io.zipcoder.persistenceapp.Service.HomeService;
6
+import org.springframework.beans.factory.annotation.Autowired;
7
+import org.springframework.http.HttpStatus;
8
+import org.springframework.http.ResponseEntity;
9
+import org.springframework.web.bind.annotation.*;
10
+
11
+@RestController
12
+public class HomeController {
13
+
14
+    @Autowired
15
+    private HomeService homeService;
16
+
17
+    @GetMapping("/home")
18
+    public ResponseEntity<Iterable<Home>> getAllHomes() {
19
+        return new ResponseEntity<>(homeService.getAllHomes(), HttpStatus.OK);
20
+    }
21
+
22
+    @PostMapping("/home/{address}/{homeNumber}")
23
+    public ResponseEntity<Boolean> createHome(@PathVariable String address, @PathVariable String homeNumber) {
24
+        return new ResponseEntity<>(homeService.createHome(address, homeNumber), HttpStatus.CREATED);
25
+    }
26
+
27
+    @PutMapping("/home/{ID}/{personID}")
28
+    public ResponseEntity<Person> addPersonToHome(@PathVariable Long ID, @PathVariable Long personID) {
29
+        return new ResponseEntity<>(homeService.addPersonToHome(ID, personID), HttpStatus.OK);
30
+    }
31
+
32
+    @PutMapping("/home/{ID}/{address}/{homeNumber}")
33
+    public ResponseEntity<Home> updateHome(@PathVariable Long ID, @PathVariable String address, @PathVariable String homeNumber) {
34
+        return new ResponseEntity<>(homeService.updateHome(ID, address, homeNumber), HttpStatus.OK);
35
+    }
36
+
37
+    @DeleteMapping("/home/ID/{ID}")
38
+    public ResponseEntity<Boolean> deleteHome(@PathVariable Long ID) {
39
+        return new ResponseEntity<>(homeService.deleteHome(ID), HttpStatus.ACCEPTED);
40
+    }
41
+
42
+    @GetMapping("/home/ID/{ID}")
43
+    public ResponseEntity<Home> findByID(@PathVariable Long ID) {
44
+        return new ResponseEntity<>(homeService.findById(ID), HttpStatus.OK);
45
+    }
46
+
47
+    @GetMapping("/home/homeNumber/{homeNumber}")
48
+    public ResponseEntity<Home> findByHomeNumber(@PathVariable String homeNumber) {
49
+        return new ResponseEntity<>(homeService.findByHomeNumber(homeNumber), HttpStatus.OK);
50
+    }
51
+
52
+    @GetMapping("/home/address/{address}")
53
+    public ResponseEntity<Home> findByAddress(@PathVariable String address) {
54
+        return new ResponseEntity<>(homeService.findByAddress(address), HttpStatus.OK);
55
+    }
56
+
57
+    @GetMapping("/home/person/{personID}")
58
+    public ResponseEntity<Home> findByPersonID(@PathVariable Long personID) {
59
+        return new ResponseEntity<>(homeService.findByPersonID(personID), HttpStatus.OK);
60
+    }
61
+
62
+    @GetMapping("/home/occupants/ID/{ID}")
63
+    public ResponseEntity<Iterable<Person>> getAllHomeOccupants_ById(@PathVariable Long ID) {
64
+        return new ResponseEntity<>(homeService.getAllHomeOccupants_ByID(ID), HttpStatus.OK);
65
+    }
66
+
67
+    @GetMapping("/home/occupants/address/{address}")
68
+    public ResponseEntity<Iterable<Person>> getAllHomeOccupants_ByAddress(@PathVariable String address) {
69
+        return new ResponseEntity<>(homeService.getAllHomeOccupants_ByAddress(address), HttpStatus.OK);
70
+    }
71
+
72
+    @GetMapping("/home/occupants")
73
+    public ResponseEntity<Iterable<Home>> getHomesWithMultipleOccupants() {
74
+        return new ResponseEntity<>(homeService.getHomesWithMultipleOccupants(), HttpStatus.OK);
75
+    }
76
+
77
+
78
+
79
+}

+ 56
- 0
src/main/java/io/zipcoder/persistenceapp/Controller/PersonController.java Parādīt failu

@@ -0,0 +1,56 @@
1
+package io.zipcoder.persistenceapp.Controller;
2
+
3
+import io.zipcoder.persistenceapp.Model.Person;
4
+import io.zipcoder.persistenceapp.Service.PersonService;
5
+import org.springframework.beans.factory.annotation.Autowired;
6
+import org.springframework.http.HttpStatus;
7
+import org.springframework.http.ResponseEntity;
8
+import org.springframework.web.bind.annotation.*;
9
+import java.sql.Date;
10
+
11
+@RestController
12
+public class PersonController {
13
+
14
+    private final PersonService personService;
15
+
16
+    @Autowired
17
+    public PersonController(PersonService personService) {
18
+        this.personService = personService;
19
+    }
20
+
21
+    @GetMapping("/person")
22
+    public ResponseEntity<Iterable<Person>> getAllPersons() {
23
+        return new ResponseEntity<>(personService.getAllPersons(), HttpStatus.OK);
24
+    }
25
+
26
+    @PostMapping("/person/{firstName}/{lastName}/{birthDate}/{mobileNumber}")
27
+    public ResponseEntity<Boolean> createPerson(@PathVariable String firstName, @PathVariable String lastName, @PathVariable Date birthDate, @PathVariable String mobileNumber) {
28
+        return new ResponseEntity<>(personService.createPerson(firstName, lastName, birthDate, mobileNumber), HttpStatus.CREATED);
29
+    }
30
+
31
+    @GetMapping("/person/{ID}")
32
+    public ResponseEntity<Person> getPerson(@PathVariable Integer ID) {
33
+        return new ResponseEntity<>(personService.getPerson(ID), HttpStatus.OK);
34
+    }
35
+
36
+    @PutMapping("/person/{ID}/{firstName}/{lastName}/{birthDate}/{mobileNumber}")
37
+    public ResponseEntity<Person> updatePerson(@PathVariable Integer ID, @PathVariable String firstName, @PathVariable String lastName, @PathVariable Date birthDate, @PathVariable String mobileNumber) {
38
+        return new ResponseEntity<>(personService.updatePerson(ID, firstName, lastName, birthDate, mobileNumber), HttpStatus.OK);
39
+    }
40
+
41
+    @DeleteMapping("/person/{ID}")
42
+    public ResponseEntity<Boolean> deletePerson(@PathVariable Integer ID) {
43
+        return new ResponseEntity<>(personService.deletePerson(ID), HttpStatus.ACCEPTED);
44
+    }
45
+
46
+    @GetMapping("/person/reverseLookup/{mobileNumber}")
47
+    public ResponseEntity<Iterable<Person>> getByMobile(@PathVariable String mobileNumber) {
48
+        return new ResponseEntity<>(personService.getByMobile(mobileNumber), HttpStatus.OK);
49
+    }
50
+
51
+    @GetMapping("/person/surname/{lastName}")
52
+    public ResponseEntity<Iterable<Person>> getBySurname(@PathVariable String lastName) {
53
+        return new ResponseEntity<>(personService.getBySurname(lastName), HttpStatus.OK);
54
+    }
55
+
56
+}

+ 40
- 0
src/main/java/io/zipcoder/persistenceapp/Model/Home.java Parādīt failu

@@ -0,0 +1,40 @@
1
+package io.zipcoder.persistenceapp.Model;
2
+
3
+public class Home {
4
+
5
+    private Long ID;
6
+    private String address;
7
+    private String homeNumber;
8
+
9
+    public Home(){}
10
+
11
+    public Home(Long ID, String address, String homeNumber) {
12
+        this.ID = ID;
13
+        this.address = address;
14
+        this.homeNumber = homeNumber;
15
+    }
16
+
17
+    public Long getID() {
18
+        return ID;
19
+    }
20
+
21
+    public void setID(Long ID) {
22
+        this.ID = ID;
23
+    }
24
+
25
+    public String getAddress() {
26
+        return address;
27
+    }
28
+
29
+    public void setAddress(String address) {
30
+        this.address = address;
31
+    }
32
+
33
+    public String getHomeNumber() {
34
+        return homeNumber;
35
+    }
36
+
37
+    public void setHomeNumber(String homeNumber) {
38
+        this.homeNumber = homeNumber;
39
+    }
40
+}

+ 18
- 0
src/main/java/io/zipcoder/persistenceapp/Model/HomeMapper.java Parādīt failu

@@ -0,0 +1,18 @@
1
+package io.zipcoder.persistenceapp.Model;
2
+
3
+import org.springframework.jdbc.core.RowMapper;
4
+
5
+import java.sql.ResultSet;
6
+import java.sql.SQLException;
7
+
8
+public class HomeMapper implements RowMapper<Home> {
9
+
10
+    public Home mapRow(ResultSet resultSet, int rowNum) throws SQLException {
11
+        Home home = new Home();
12
+        home.setID(resultSet.getLong("ID"));
13
+        home.setAddress(resultSet.getString("ADDRESS"));
14
+        home.setHomeNumber(resultSet.getString("HOMENUMBER"));
15
+        return home;
16
+    }
17
+
18
+}

+ 91
- 0
src/main/java/io/zipcoder/persistenceapp/Model/Person.java Parādīt failu

@@ -0,0 +1,91 @@
1
+package io.zipcoder.persistenceapp.Model;
2
+
3
+import javax.persistence.Column;
4
+import javax.persistence.Entity;
5
+import javax.persistence.GeneratedValue;
6
+import javax.persistence.Id;
7
+import java.sql.Date;
8
+
9
+@Entity
10
+public class Person {
11
+
12
+    @Id
13
+    @GeneratedValue
14
+    private Integer ID;
15
+
16
+    @Column(name = "FIRST_NAME")
17
+    private String firstName;
18
+
19
+    @Column(name = "LAST_NAME")
20
+    private String lastName;
21
+
22
+    @Column(name = "BIRTHDAY")
23
+    private Date birthDate;
24
+
25
+    @Column(name = "MOBILE")
26
+    private String mobileNumber;
27
+
28
+    public Person(){}
29
+
30
+    public Person(String firstName, String lastName, Date birthDate, String mobileNumber) {
31
+        this.firstName = firstName;
32
+        this.lastName = lastName;
33
+        this.birthDate = birthDate;
34
+        this.mobileNumber = mobileNumber;
35
+    }
36
+
37
+    public Person(Integer ID, String firstName, String lastName, Date birthDate, String mobileNumber) {
38
+        this.ID = ID;
39
+        this.firstName = firstName;
40
+        this.lastName = lastName;
41
+        this.birthDate = birthDate;
42
+        this.mobileNumber = mobileNumber;
43
+    }
44
+
45
+    public Integer getID() {
46
+        return ID;
47
+    }
48
+
49
+    public void setID(Integer ID) {
50
+        this.ID = ID;
51
+    }
52
+
53
+    public String getFirstName() {
54
+        return firstName;
55
+    }
56
+
57
+    public void setFirstName(String firstName) {
58
+        this.firstName = firstName;
59
+    }
60
+
61
+    public String getLastName() {
62
+        return lastName;
63
+    }
64
+
65
+    public void setLastName(String lastName) {
66
+        this.lastName = lastName;
67
+    }
68
+
69
+    public Date getBirthDate() {
70
+        return birthDate;
71
+    }
72
+
73
+    public void setBirthDate(Date birthDate) {
74
+        this.birthDate = birthDate;
75
+    }
76
+
77
+    public String getMobileNumber() {
78
+        return mobileNumber;
79
+    }
80
+
81
+    public void setMobileNumber(String mobileNumber) {
82
+        this.mobileNumber = mobileNumber;
83
+    }
84
+
85
+    @Override
86
+    public String toString() {
87
+        return String.format(
88
+                "Person[ID=%d, firstName='%s', lastName='%s', birthDate='%s', mobileNumber='%s']",
89
+                ID, firstName, lastName, birthDate, mobileNumber);
90
+    }
91
+}

+ 19
- 0
src/main/java/io/zipcoder/persistenceapp/Model/PersonMapper.java Parādīt failu

@@ -0,0 +1,19 @@
1
+package io.zipcoder.persistenceapp.Model;
2
+
3
+import org.springframework.jdbc.core.RowMapper;
4
+import java.sql.ResultSet;
5
+import java.sql.SQLException;
6
+
7
+public class PersonMapper implements RowMapper<Person> {
8
+
9
+        public Person mapRow(ResultSet resultSet, int rowNum) throws SQLException {
10
+            Person person = new Person();
11
+            person.setID(resultSet.getInt("ID"));
12
+            person.setFirstName(resultSet.getString("FIRST_NAME"));
13
+            person.setLastName(resultSet.getString("LAST_NAME"));
14
+            person.setBirthDate(resultSet.getDate("BIRTHDAY"));
15
+            person.setMobileNumber(resultSet.getString("MOBILE"));
16
+            return person;
17
+        }
18
+
19
+}

+ 9
- 0
src/main/java/io/zipcoder/persistenceapp/Repository/PersonRepository.java Parādīt failu

@@ -0,0 +1,9 @@
1
+package io.zipcoder.persistenceapp.Repository;
2
+
3
+import io.zipcoder.persistenceapp.Model.Person;
4
+import org.springframework.data.jpa.repository.JpaRepository;
5
+import org.springframework.stereotype.Repository;
6
+
7
+@Repository
8
+public interface PersonRepository extends JpaRepository<Person, Integer> {
9
+}

+ 72
- 0
src/main/java/io/zipcoder/persistenceapp/Service/HomeService.java Parādīt failu

@@ -0,0 +1,72 @@
1
+package io.zipcoder.persistenceapp.Service;
2
+
3
+import io.zipcoder.persistenceapp.Model.Home;
4
+import io.zipcoder.persistenceapp.Model.HomeMapper;
5
+import io.zipcoder.persistenceapp.Model.Person;
6
+import io.zipcoder.persistenceapp.Model.PersonMapper;
7
+import org.springframework.beans.factory.annotation.Autowired;
8
+import org.springframework.jdbc.core.JdbcTemplate;
9
+import org.springframework.stereotype.Service;
10
+
11
+@Service
12
+public class HomeService {
13
+
14
+    private final JdbcTemplate jdbcTemplate;
15
+
16
+    @Autowired
17
+    public HomeService(JdbcTemplate jdbcTemplate) {
18
+        this.jdbcTemplate = jdbcTemplate;
19
+    }
20
+
21
+    public Iterable<Home> getAllHomes() {
22
+        return this.jdbcTemplate.query( "SELECT * FROM HOME", new HomeMapper());
23
+    }
24
+
25
+    public Boolean createHome(String address, String homeNumber){
26
+        return this.jdbcTemplate.update("INSERT INTO HOME (ADDRESS, HOMENUMBER) VALUES (?, ?)",
27
+                address, homeNumber) == 1;
28
+    }
29
+
30
+    public Person addPersonToHome(Long ID, Long personID){
31
+        this.jdbcTemplate.update("UPDATE PERSON SET HOME_ID = ? WHERE ID = ?", ID, personID);
32
+        return this.jdbcTemplate.queryForObject("SELECT * FROM PERSON WHERE ID = ?", new Object[] { personID }, new PersonMapper());
33
+    }
34
+
35
+    public Home updateHome(Long ID, String address, String homeNumber) {
36
+        this.jdbcTemplate.update("UPDATE HOME SET ADDRESS = ? SET HOMENUMBER = ? WHERE ID = ?", address, homeNumber, ID);
37
+        return findById(ID);
38
+    }
39
+
40
+    public Boolean deleteHome(Long ID) {
41
+        return this.jdbcTemplate.update("DELETE FROM HOME WHERE ID = ?", ID) == 1;
42
+    }
43
+
44
+    public Home findById(Long ID){
45
+        return this.jdbcTemplate.queryForObject("SELECT * FROM HOME WHERE ID = ?", new Object[] { ID }, new HomeMapper());
46
+    }
47
+
48
+    public Home findByHomeNumber(String homeNumber){
49
+        return this.jdbcTemplate.queryForObject("SELECT * FROM HOME WHERE HOMENUMBER = ?", new Object[] { homeNumber }, new HomeMapper());
50
+    }
51
+
52
+    public Home findByAddress(String address){
53
+        return this.jdbcTemplate.queryForObject("SELECT * FROM HOME WHERE ADDRESS = ?", new Object[] { address }, new HomeMapper());
54
+    }
55
+
56
+    public Home findByPersonID(Long personID){
57
+        return this.jdbcTemplate.queryForObject("SELECT HOME.* FROM HOME JOIN PERSON ON HOME.ID = PERSON.HOME_ID WHERE PERSON.ID = ?", new Object[] { personID }, new HomeMapper());
58
+    }
59
+
60
+    public Iterable<Person> getAllHomeOccupants_ByID(Long ID) {
61
+        return this.jdbcTemplate.query("SELECT PERSON.* FROM PERSON WHERE HOME_ID = ?", new Object[] { ID}, new PersonMapper());
62
+    }
63
+
64
+    public Iterable<Person> getAllHomeOccupants_ByAddress(String address) {
65
+        return this.jdbcTemplate.query("SELECT PERSON.* FROM PERSON JOIN HOME ON HOME.ID = PERSON.HOME_ID WHERE ADDRESS = ?", new Object[] { address }, new PersonMapper());
66
+    }
67
+
68
+    public Iterable<Home> getHomesWithMultipleOccupants() {
69
+        return this.jdbcTemplate.query("SELECT HOME.*, COUNT(PERSON.ID) FROM HOME JOIN PERSON ON HOME.ID = PERSON.HOME_ID GROUP BY HOME.ID HAVING COUNT(HOME_ID) > 1", new HomeMapper());
70
+    }
71
+
72
+}

+ 51
- 0
src/main/java/io/zipcoder/persistenceapp/Service/JdbcPersonServiceImpl.java Parādīt failu

@@ -0,0 +1,51 @@
1
+package io.zipcoder.persistenceapp.Service;
2
+
3
+import io.zipcoder.persistenceapp.Model.Person;
4
+import io.zipcoder.persistenceapp.Model.PersonMapper;
5
+import org.springframework.beans.factory.annotation.Autowired;
6
+import org.springframework.jdbc.core.JdbcTemplate;
7
+import org.springframework.stereotype.Service;
8
+
9
+import java.sql.Date;
10
+
11
+@Service
12
+public class JdbcPersonServiceImpl implements PersonService {
13
+
14
+    private final JdbcTemplate jdbcTemplate;
15
+
16
+    @Autowired
17
+    public JdbcPersonServiceImpl(JdbcTemplate jdbcTemplate) {
18
+        this.jdbcTemplate = jdbcTemplate;
19
+    }
20
+
21
+    public Iterable<Person> getAllPersons() {
22
+        return this.jdbcTemplate.query( "SELECT * FROM PERSON", new PersonMapper());
23
+    }
24
+
25
+    public Boolean createPerson(String firstName, String lastName, Date birthDate, String mobileNumber){
26
+        return this.jdbcTemplate.update("INSERT INTO PERSON (FIRST_NAME, LAST_NAME, BIRTHDAY, MOBILE) VALUES (?, ?, ?, ?)",
27
+                firstName, lastName, birthDate, mobileNumber) == 1;
28
+    }
29
+
30
+    public Person getPerson(Integer ID) {
31
+        return this.jdbcTemplate.queryForObject("SELECT * FROM PERSON WHERE ID = ?", new Object[] { ID }, new PersonMapper());
32
+    }
33
+
34
+    public Person updatePerson(Integer ID, String firstName, String lastName, Date birthDate, String mobileNumber){
35
+        this.jdbcTemplate.update("UPDATE PERSON SET FIRST_NAME = ? SET LAST_NAME = ? SET BIRTHDAY = ? SET MOBILE = ? WHERE ID = ?", firstName, lastName, birthDate, mobileNumber, ID);
36
+        return getPerson(ID);
37
+    }
38
+
39
+    public Boolean deletePerson(Integer ID) {
40
+        return this.jdbcTemplate.update("DELETE FROM PERSON WHERE ID = ?", ID) == 1;
41
+    }
42
+
43
+    public Iterable<Person> getByMobile(String mobileNumber) {
44
+        return this.jdbcTemplate.query( "SELECT * FROM PERSON WHERE MOBILE = ?", new Object[] { mobileNumber }, new PersonMapper());
45
+    }
46
+
47
+    public Iterable<Person> getBySurname(String lastName) {
48
+        return this.jdbcTemplate.query("SELECT * FROM PERSON WHERE LAST_NAME = ?", new Object[] { lastName }, new PersonMapper());
49
+    }
50
+
51
+}

+ 71
- 0
src/main/java/io/zipcoder/persistenceapp/Service/JpaPersonServiceImpl.java Parādīt failu

@@ -0,0 +1,71 @@
1
+package io.zipcoder.persistenceapp.Service;
2
+
3
+import io.zipcoder.persistenceapp.Model.Person;
4
+import io.zipcoder.persistenceapp.Repository.PersonRepository;
5
+import org.springframework.beans.factory.annotation.Autowired;
6
+import org.springframework.context.annotation.Primary;
7
+import org.springframework.stereotype.Service;
8
+
9
+import java.sql.Date;
10
+import java.util.ArrayList;
11
+import java.util.List;
12
+
13
+@Primary
14
+@Service
15
+public class JpaPersonServiceImpl implements PersonService {
16
+
17
+    private final PersonRepository personRepository;
18
+
19
+    @Autowired
20
+    public JpaPersonServiceImpl(PersonRepository personRepository) {
21
+        this.personRepository = personRepository;
22
+    }
23
+
24
+    public Iterable<Person> getAllPersons() {
25
+        return this.personRepository.findAll();
26
+    }
27
+
28
+    public Boolean createPerson(String firstName, String lastName, Date birthDate, String mobileNumber){
29
+        this.personRepository.save(new Person(firstName, lastName, birthDate, mobileNumber));
30
+        return true;
31
+    }
32
+
33
+    public Person getPerson(Integer ID) {
34
+        return this.personRepository.findOne(ID);
35
+    }
36
+
37
+    public Person updatePerson(Integer ID, String firstName, String lastName, Date birthDate, String mobileNumber){
38
+        Person person = getPerson(ID);
39
+        person.setFirstName(firstName);
40
+        person.setLastName(lastName);
41
+        person.setBirthDate(birthDate);
42
+        person.setMobileNumber(mobileNumber);
43
+        return this.personRepository.save(person);
44
+    }
45
+
46
+    public Boolean deletePerson(Integer ID) {
47
+        this.personRepository.delete(ID);
48
+        return true;
49
+    }
50
+
51
+    public Iterable<Person> getByMobile(String mobileNumber) {
52
+        List<Person> ppl = new ArrayList<>();
53
+        for (Person person : personRepository.findAll()) {
54
+            if (mobileNumber.equals(person.getMobileNumber())) {
55
+                ppl.add(person);
56
+            }
57
+        }
58
+        return ppl;
59
+    }
60
+
61
+    public Iterable<Person> getBySurname(String lastName) {
62
+        List<Person> ppl = new ArrayList<>();
63
+        for (Person person : personRepository.findAll()) {
64
+            if (lastName.equals(person.getLastName())) {
65
+                ppl.add(person);
66
+            }
67
+        }
68
+        return ppl;
69
+    }
70
+
71
+}

+ 17
- 0
src/main/java/io/zipcoder/persistenceapp/Service/PersonService.java Parādīt failu

@@ -0,0 +1,17 @@
1
+package io.zipcoder.persistenceapp.Service;
2
+
3
+import io.zipcoder.persistenceapp.Model.Person;
4
+
5
+import java.sql.Date;
6
+
7
+public interface PersonService {
8
+
9
+    Iterable<Person> getAllPersons();
10
+    Boolean createPerson(String firstName, String lastName, Date birthDate, String mobileNumber);
11
+    Person getPerson(Integer ID);
12
+    Person updatePerson(Integer ID, String firstName, String lastName, Date birthDate, String mobileNumber);
13
+    Boolean deletePerson(Integer ID);
14
+    Iterable<Person> getByMobile(String mobileNumber);
15
+    Iterable<Person> getBySurname(String lastName);
16
+
17
+}

+ 3
- 2
src/main/resources/application-h2.properties Parādīt failu

@@ -1,4 +1,5 @@
1
-spring.datasource.url=jdbc:h2:mem:testdb;Mode=Oracle
1
+spring.datasource.url=jdbc:h2:mem:test;Mode=Oracle
2 2
 spring.datasource.platform=h2
3 3
 spring.jpa.hibernate.ddl-auto=none
4
-spring.datasource.continue-on-error=true
4
+spring.datasource.continue-on-error=true
5
+spring.datasource.initialize=true

src/main/resources/schema-h2.sql → src/main/resources/schema.sql Parādīt failu


+ 2
- 0
src/main/resources/script.sql Parādīt failu

@@ -1,3 +1,5 @@
1
+DROP TABLE IF EXISTS MOVIES;
2
+
1 3
 CREATE TABLE MOVIES (
2 4
 ID INT NOT NULL AUTO_INCREMENT,
3 5
 Title VARCHAR(255),