Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null not allowed for column **ID #1

Open
MrNocTV opened this issue Sep 12, 2019 · 3 comments
Open

Null not allowed for column **ID #1

MrNocTV opened this issue Sep 12, 2019 · 3 comments
Assignees

Comments

@MrNocTV
Copy link

MrNocTV commented Sep 12, 2019

I got problems with the default generated strategy GenerationType.AUTO , I add GenerationType.SEQUENCE for

  • ScoreCard.java
  • Multiplication.java
  • MultiplicationResultAttempt.java
  • User.java

then everything works just fine.

Please verify this issue and allow me to create a new PR if my solution is correct.

@mechero
Copy link
Contributor

mechero commented Sep 20, 2019

Hi,

Are you using the same library versions as in this repository? Also, please describe exactly what are the problems you're finding.

Thanks!

@mechero mechero self-assigned this Sep 20, 2019
@MrNocTV
Copy link
Author

MrNocTV commented Sep 20, 2019

Hi @mechero ,
The problem is I cannot persist object due to "null pointer exception" with column *ID. I don't think it's due to the difference in version because I already tried using your existing code.
Also from this post of thoughts-on-java. We should use GenerationType.SEQUENCE because it's better in term of performance and it will work on all versions of hibernate.

@mechero
Copy link
Contributor

mechero commented Sep 22, 2019

I'm not saying it's not better to use it, but I need to comment the code to indicate from which version of [Hibernate / Spring Boot / other libraries] the code doesn't work anymore. Keep in mind that this repo is referenced from a book that is "static" between editions so it needs to be very clear in comments what differs from the edition and why it's been changed.

This was certainly working by the time the book got released so there must be a difference somewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants