akuma8 (8) [Avatar] Offline
#1
Hi Craig,

I've just finished this chapter and I'm a little confused.
First the domain classes isn't clear, what should we use between Taco and Design ?
If we should use Taco, please review the html file design.html to correct data-binding for the List<Ingredient> ingredients attribute.
In fact the binding doesn't work as Ingredient is a complex class but with a list of string List<String> ingredients the binding works very well.
As I don't master Thymeleaf I kept my list of strings but I have some issues when dealing with JPA because I can't use @ManyToMany with a list of String.

I also have one question about Spring JdbcTemplate vs Spring Data JPA.
In which case should we use one or the other? I always use Spring Data JPA but if they include JdbcTemplate it's for some reasons.
Thanks a lot.

PS : for correction :

You forgot some @Autowired annotations in controllers.

And see the striked word :


As shown in Listing 3.4 , the RowMapper parameter for both findAll() and findOne() is given as a method reference to the mapRowToIngredient() method. Java 8’s method references and lambdas are especially convenient when working with JdbcTemplate as an alternative to an explicit RowMapper implementation. But if for some reason you want or need an explicit RowMapper, then the following implementation of findAll() findOne() shows how to use an explicit implementation of RowMapper instead: