FAQ: Add a Database with JPA - Review

This community-built FAQ covers the “Review” exercise from the lesson “Add a Database with JPA”.

Paths and Courses
This exercise can be found in the following Codecademy content:

(Beta) Create REST APIs with Spring and Java

FAQs on the exercise Review

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!
You can also find further discussion and get answers to your questions over in Language Help.

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head to Language Help and Tips and Resources. If you are wanting feedback or inspiration for a project, check out Projects.

Looking for motivation to keep learning? Join our wider discussions in Community

Learn more about how to use this guide.

Found a bug? Report it online, or post in Bug Reporting

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

We have learned to execute CRUD operations on H2 database in this section but can someone provide steps to set up H2 database locally with details?
Also, the downloaded project coffeeorders.zip project files are imported as projects into Intellij Idea. Can someone share the steps to run this project inside Intellij? Currently, after IntelliJ resolves dependencies, it is throwing an error:
Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.5.0

Overall, I would say it would be better to have provided the steps to setup these projects in IntelliJ and run them as we do in Codecademy workspace. This would allow us to practice and play around with the code locally with our own setup which will provide better understanding of the topics.

Hey mate. What do you mean by “downloaded project coffeeorders.zip” ? Is there a such project here ? which lesson ?

By the way to answer your question, I don’t know that error but using Spring/maven in Intellij Idea has some problems. Everything should be consisten with your computer. For example if you have spesific java version, not every maven version is compatible. You need to play around in pom file.

The other question to provide step by step: You remember Super Hero project earlier ? I copied it to Intellij Idea step by step. You can see the folder names class names etc in Codecademy project structure, I created everything same just myself.

I encountered lots of bug errors but most of them was related with Java / Maven version incompatibility. After That syntax of Curl commands also pain in the ■■■.

It would be good if they provide step by step guidance to run the project in Intellij Idea instead of Codecademy workspace. But you can still create it by yourself by looking at the folder structure of the project in Codecademy workspace.

Hey, thanks for responding to my message.
You can find the coffeeorders.zip in the Downloads section here
However, I’m not receiving the error I mentioned instead a different error when running `./mvnw spring-boot:run command.

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project coffeeorders: Fatal error compiling: invalid target release: 11

But, I can also run the CoffeeOrdersApplication successfully, triggering the Tomcat server. I think the project is pre-built. I’m able to run the API endpoints successfully.

Thanks for the input and help though. I agree with your approach to creating the same project structure locally.

This kind of errors usually related with Java / JDK / Maven versions, and also related to PATH variables in Windows Environment variables. Your JDK or Java version, one of them is not 11 I think.
You need to make sure you have JDK 11 or (Java 11) installed on your machine, . And you need to check if JAVA_HOME environment variable is set to correctly.

It’s really annoying. If I should give a percentage, %70-80 of my errors are related with maven version / java version incompatiblity, some PATH is not set in Environment variable etc.

I will try coffeeorders project in Intellij and see if I will have errors.

1 Like