I am new to Java Spring Boot and JPA. I've got two tables -- one is an accounts table the site will manage "TblLogin" - the other "TblPatient" will be populated by third-party data (unmanaged) on the site.
//look up method
So in this demo here - I have a user login -- email, password -- I need to do first a look up that satisfies not just "findByEmail" - but also "findByEmailAndPassword" and also encrpt the password value before it goes off to do a check.
On finding an acc -- it then gets the pin col data - like 1345 -- and does a look up on the third party table. --
-- now I am sure there is a more sophisticated way of doing this - maybe even via a join? But I am unsure.
TblLogin acc = tblLoginRepository.findByEmail(email);
String pin = acc.getPin();
TblPatient ext = tblPatientRepository.findByPatientID(pin);
JSONObject response = new JSONObject();
response.put("tblLogin", acc.getEmail());
response.put("tblPatient", ext.getId());
- would it be something like Would it be something like -- "findByEmailContainingAndPasswordContainingAllIgnoringCase(String email, String passwordEncoder.encode(password));" ?
or more like
findByEmailAndPasswordAllIgnoringCase(String email, String passwordEncoder.encode(password)));