I am using Spring Data JPA to create and query my tables.
This is my UserService
class,
@Service
public class UserService {
@Autowired
UserRepository userRepository;
public User saveUser(User u) {
User savedUser = userRepository.save(u); //<----- line that I debug
return savedUser;
}
public boolean usernameExists(String username) {
List<User> users = userRepository.findByUsername(username); //<----- line that I debug
return !users.isEmpty();
}
}
and this is the UserRepository
class
public interface UserRepository extends CrudRepository<User, Integer> {
public List<User> findByUsername(String username);
}
I am debugging my code and when the reach the above 'linesToDebug', I do a Step-Into in my IDE, hoping I would be taken to the implementation of the methods save()
and findByUsername()
, but nothing happens, the user is saved to the repository and my IDE (Netbeans 8.0) does not navigate to the implementation of these methods.
Which class has these methods implemented?
Edit: This is what I get in the console on the save() method:
2021-06-06 16:24:36.779 DEBUG 6948 --- [nio-8181-exec-5] org.hibernate.SQL : insert into user (date_created, password, username) values (?, ?, ?)
2021-06-06 16:24:36.784 TRACE 6948 --- [nio-8181-exec-5] o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [TIMESTAMP] - [Sun Jun 06 16:24:27 IST 2021]
2021-06-06 16:24:36.791 TRACE 6948 --- [nio-8181-exec-5] o.h.type.descriptor.sql.BasicBinder : binding parameter [2] as [VARCHAR] - [$2a$10$Ad0G05HssJUb4xaEMTqFTOlWZijMbXBSLSgyxbjVQzOEdZn7Lxuz2]
But there is no class named SQL
in org.hibernate
package .