DEV Community

WangGithub0
WangGithub0

Posted on

1

Keep on working on open-source Spring Boot project

After trying to find a runnable spring boot project for beginner.

I began to fix another bug for this E-commerce-project-springBoot project.

In order to login the project, I had to create some base data in the database, I did it according to the mysql document, but I got some errors, so I tried to revised them.

Image description

SET SQL_MODE ='IGNORE_SPACE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
Enter fullscreen mode Exit fullscreen mode
  • Register met error "Duplicate entry '1' for key 'customer.PRIMARY'. After searching, I found running the basedata.sql script on the database has manually inserted records with IDs '1' and '2' into the CUSTOMER table. Since the code use the GenerationType.AUTO strategy for ID generation, MySQL is attempting to automatically generate the next available ID when try to insert a new record. However, this conflicts with the existing IDs manually inserted before.

So I set:

@GeneratedValue(strategy=GenerationType.IDENTITY)
private int id;
Enter fullscreen mode Exit fullscreen mode

Image description

Image description

I also add try catch for addUser since sometimes add action failed and updated the README, make it much clearly.

During this process, I acquired fundamental knowledge of Spring Boot, MySQL, Maven, and IntelliJ. I gained insights into connecting Java with databases, utilizing JPA for data persistence, and enhancing my understanding of Java development. Despite my limited experience in Java, I recognize there is still much to learn and explore. This experience served as a valuable foundation, highlighting areas for improvement and offering a glimpse into the vast landscape of Java development that lies ahead for me.

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay