Skip to content
This repository was archived by the owner on Oct 21, 2024. It is now read-only.

Commit a249be1

Browse files
committed
spring-action fixed DBB error
1 parent e387c36 commit a249be1

File tree

4 files changed

+21
-13
lines changed

4 files changed

+21
-13
lines changed

spring/spring-in-action/chapter-1.3/src/main/java/es/msanchez/spring/springinaction/controllers/DesignTacoController.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ public String processDesign(@Valid @ModelAttribute("design") final Taco design,
9797
}
9898

9999
final Taco saved = this.tacoRepository.save(design);
100+
order.getTacos().add(saved);
100101

101102
log.info("processing design '{}'", design);
102103
return "redirect:/orders/current";

spring/spring-in-action/chapter-1.3/src/main/java/es/msanchez/spring/springinaction/entities/Order.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
import javax.validation.constraints.NotBlank;
88
import javax.validation.constraints.Pattern;
99
import java.sql.Date;
10+
import java.util.ArrayList;
11+
import java.util.List;
1012

1113
@Data
1214
public class Order {
@@ -40,4 +42,6 @@ public class Order {
4042
@Digits(integer = 3, fraction = 0, message = "invalid CVV")
4143
private String ccCVV;
4244

45+
private List<Taco> tacos = new ArrayList<>();
46+
4347
}

spring/spring-in-action/chapter-1.3/src/main/resources/data.sql

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@ DELETE FROM Taco_Order;
55
DELETE FROM Ingredient;
66

77
INSERT INTO Ingredient (id, name, type)
8-
VALUES ("FLTO", "Flour Tortilla", "Wrap");
8+
VALUES ('FLTO', 'Flour Tortilla', 'WRAP');
99
INSERT INTO Ingredient (id, name, type)
10-
VALUES ("COTO", "Corn Tortilla", "Wrap");
10+
VALUES ('COTO', 'Corn Tortilla', 'WRAP');
1111
INSERT INTO Ingredient (id, name, type)
12-
VALUES ("GRBF", "Ground Beef", "Protein");
12+
VALUES ('GRBF', 'Ground Beef', 'PROTEIN');
1313
INSERT INTO Ingredient (id, name, type)
14-
VALUES ("CARN", "Carnitas", "Protein");
14+
VALUES ('CARN', 'Carnitas', 'PROTEIN');
1515
INSERT INTO Ingredient (id, name, type)
16-
VALUES ("TMTO", "Diced Tomatoes", "Veggies");
16+
VALUES ('TMTO', 'Diced Tomatoes', 'VEGGIES');
1717
INSERT INTO Ingredient (id, name, type)
18-
VALUES ("LETC", "Lettuce", "Veggies");
18+
VALUES ('LETC', 'Lettuce', 'VEGGIES');
1919
INSERT INTO Ingredient (id, name, type)
20-
VALUES ("CHED", "Cheddar", "Cheese");
20+
VALUES ('CHED', 'Cheddar', 'CHEESE');
2121
INSERT INTO Ingredient (id, name, type)
22-
VALUES ("JACK", "Monterrey Jack", "Cheese");
22+
VALUES ('JACK', 'Monterrey Jack', 'CHEESE');
2323
INSERT INTO Ingredient (id, name, type)
24-
VALUES ("SLSA", "Salsa", "Sauce");
24+
VALUES ('SLSA', 'Salsa', 'SAUCE');
2525
INSERT INTO Ingredient (id, name, type)
26-
VALUES ("SRCR", "Sour Cream", "Sauce");
26+
VALUES ('SRCR', 'Sour Cream', 'SAUCE');

spring/spring-in-action/chapter-1.3/src/test/java/es/msanchez/spring/springinaction/TacoCloudApplicationTests.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@
55
import org.springframework.boot.test.context.SpringBootTest;
66
import org.springframework.test.context.junit4.SpringRunner;
77

8-
@RunWith(SpringRunner.class) @SpringBootTest public class TacoCloudApplicationTests {
8+
@RunWith(SpringRunner.class)
9+
@SpringBootTest
10+
public class TacoCloudApplicationTests {
911

10-
@Test public void contextLoads() {
11-
}
12+
@Test
13+
public void contextLoads() {
14+
}
1215

1316
}

0 commit comments

Comments
 (0)