Closed hmkurth closed 3 years ago
Good work @hmkurth. I think you are making really good progress! In fact, you are pretty close to complete with Checkpoint 2, which isn't due until next week!
A few things to keep in mind as you continue work in the coming weeks:
I think if you search through the log4j2.properties file and replace {filepath}
with {filename}
that will fix the odd directory. oh, and you should also delete the directory name ${filepath}
that was created as a result.
[x] I am not sure if this is causing issues with your equals and toString methods, but we have to be careful with methods like toString with one-to-many relationships. Example: if User.toString writes out all the variables on user including roles, this will automatically call the Role.toString(). If the Role.toString() tries to display the User, then the User.toString() tries to display Roles, and we end up in an endless loop resulting in a StackOverflowError. At some point, you have to break the cycle - that might mean User.toString displays Roles, but Role.toString() does not display User. Does that make sense?
[x] It looks you have a start at implementing the genericDao! Once you have it fully implemented, you should be able to remove UserDao and RoleDao, leaving you with a single dao and hopefully full code coverage!
[ ] Think about testing the delete scenarios in one-to-many relationships more fully. For example, if a user is deleted, what should happen to that user's roles? What if a role is deleted? Write tests to make sure whatever should happen, does happen.
I'm having problems with this part: Think about testing the delete scenarios in one-to-many relationships more fully. For example, if a user is deleted, what should happen to that user's roles? What if a role is deleted? Write tests to make sure whatever should happen, does happen.
Ok! Let's start with this: what are your one to many relationships?
well, just for the user/roles tables, there should be one user to many roles, so if a user is deleted, so should all corresponding roles. However, if a role is deleted, i wouldn't want the user to be deleted. I have the cascade on delete annotation. I posted in slack week 5 under Robert's issue, which has the same error, for reference.
That business rule makes sense. So, I responded to your message in slack before I saw this - your annotations looked correct at first glance. Might be helpful to also share the db design out there.
@pawaitemadisoncollege Working on getting the logging just right with hibernate filepaths, I’ve been getting errors that the files can’t be renamed, so I tried renaming and moving, I fixed the error for now, but my hibernate logs aren’t I the right place with the right name…so… *I think I fixed it by removing a colon in the filename, but I very well may have screwed it up…will have to monitor logs
Sat 2/20 : 4 hrs Working on the userRole dao and testing, after implementing the .equals method I have a lot of failing tests Sunday 2 hrs: I went too far in implementing the .equals method, and did it for the userRole dao, too, which was what was leading to all the problems I was having. I am still having a problem with inserting a role without a username, so for now I have made that column not null, so I will have to monitor that as well. I don’t think I ever got that student liscense from IntelliJ, so now my sessions are limited to 30 minutes..have to check on that… I haven’t gotten as far as I wanted to on my project ☹. There are a lot of little details to get right with the hibernate Db setup, I’m dreading it a little.