#Maven Project
36 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @unborn sonnet! Please use
/closeor theClose Postbutton above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
Can anyone help me through this error
See this StackOverflow post for NullPointerExceptions and how to solve them.
more details?
Yes I can share the zip file of my project if anyone can look into it please
don't do that but just explain more on where the nullpointer is, what you're doing etc
folks won't unzip a file from a stranger - i certainly wouldn't; use a pastebin https://pastebin.com/ to show a single class where the problem is for example
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
fine but you'll still need to explain what the issue is
Yea sure
i'm not saying it's a rule (i'm not a moderator) but just a piece of advice against uploading zips
So the context is to make a School management system using maven hibernate mysql
Yea I got you
So I totally made the methods, classes organized the directory structure with the help of GPT -4 But I am stuck somewhere and I am helpless
This is my directory structure
Hello sir are you there @jolly trellis
studentservice is empty?
no its not
package com.myschool.management.sms.services;
import java.util.List;
import com.myschool.management.sms.dao.StudentI;
import com.myschool.management.sms.models.Course;
import com.myschool.management.sms.models.Student;
public class StudentService implements StudentI {
private final StudentI studentDAO; // Inject Student DAO
public StudentService(StudentI studentDAO) {
this.studentDAO = studentDAO;
}
@Override
public void createStudent(Student student) {
studentDAO.createStudent(student);
}
@Override
public List<Student> getAllStudents() {
return studentDAO.getAllStudents();
}
@Override
public Student getStudentByEmail(String email) {
return studentDAO.getStudentByEmail(email);
}
@Override
public boolean validateStudent(String email, String password) {
return studentDAO.validateStudent(email, password);
}
@Override
public void registerStudentToCourse(String email, int courseId) {
studentDAO.registerStudentToCourse(email, courseId);
}
@Override
public List<Course> getStudentCourses(String email) {
return studentDAO.getStudentCourses(email);
}
}
this is my StudentService.java
that's not what's in the repo
well I didn't start from the repo
I have made my own directory and started it from scratch
so why did you link me to the repo if it's not your code lol
It is not my code but my assignment
I didn't upload mine in the github yet that was the reason I though of sending via zip file
upload to github so we can see what your specific issue is
but anyway i suspect you are not creatingthe dao correctly and so studentdao is null
make sure studentdao isn't null by passing it in correctly as a constructor argument
Ok Let me try and come up to you thank you
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.