Great tutorial, thanks, really helped me get started with groovy and spring!
I noticed a couple of minor issues:
in the sample data INSERT statements you provided, the wild_pokemon insert will fail because it's trying to create wild pokemon owned by trainer with id = 3, but the trainer inserts only create ids 1 and 2. Easy to modify the statement like this, changing the trainer_id to match the two existing trainers:
you didn't include WildPokemonService and WildPokemonServiceImpl, but they were very straightforward to create from the TrainerService and TrainerServiceImpl:
class WildPokemonServiceImpl implements WildPokemonService {
@Autowired
private final WildPokemonRepository wildPokemonRepository
// @Override
// List findAll() {
// wildPokemonRepository.findAll()
// }
@Override
List findByTrainerId(int id) {
wildPokemonRepository.findByTrainerId(id)
}
}
package com.pokemon.service
import com.pokemon.entity.WildPokemon
interface WildPokemonService {
//List findAll()
List findByTrainerId(int id)
}
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Great tutorial, thanks, really helped me get started with groovy and spring!
I noticed a couple of minor issues:
INSERT INTO wild_pokemon VALUES
(1, 2000, 1, 1), (2, 2100, 4, 2), (7, 2000, 7, 1), (8, 600, 1, 2);
class WildPokemonServiceImpl implements WildPokemonService {
@Autowired
private final WildPokemonRepository wildPokemonRepository
// @Override
// List findAll() {
// wildPokemonRepository.findAll()
// }
@Override
List findByTrainerId(int id) {
wildPokemonRepository.findByTrainerId(id)
}
}
package com.pokemon.service
import com.pokemon.entity.WildPokemon
interface WildPokemonService {
//List findAll()
List findByTrainerId(int id)
}