habuma / spring-in-action-6-samples

Sample code from Spring in Action 6
487 stars 343 forks source link

Issue on Chapter in DesignTacoController with Spring DataJDBC #25

Closed abcool closed 9 months ago

abcool commented 10 months ago

When running the project after making changes for spring data jdbc getting error:

java.lang.IllegalStateException: Cannot set property id because no setter, no wither and it's not part of the persistence constructor private com.example.tacos.domain.Ingredient()

at line ingredientRepository.findAll().forEach(i -> ingredients.add(i));

abcool commented 10 months ago

Found a fix for this. Remove @NoArgsConstructor from Ingredient.java. Also in processOrder add this line before saving order.setOrderDate(new Date());

abcool commented 9 months ago

fixed it myself. the author doesn't reply.