Create java hibernate simple test project in eclipse

Tuesday, May 16th, 2017 (0 Comment)

We should create java hibernate simple test project to practice many techniques related to database before apply them into big real project.

This project will help us researching and run faster when we do directly in our big project.

We use Eclipse to create maven project simple and Oracle database for testing java hibernate simple (find some config for other database in Java connection and database (mysql, oracle, sql server))

1) Create maven project simple in Eclipse

– In Eclipse, select File menu –> New –> Maven Project.

– In New Maven Project dialog, uncheck create a simple project (skip archetype selection), check Use default Workspace selection and click next button.

– In Filter input, type “quickstart” and select “org.apache.maven.archetypes” “maven-archetype-quickstart” and click next button.

– Fill in dialog as below and click finish button:

  • Group id: lvtutorial.com
  • Artifact id: Simple
  • Version: 0.0.1-SNAPSHOT
  • Packages: lvtutorial.com.simple

– Continue, We open App.java file in lvtutorial.com.simple package, it have already main function, we click run and select Java Application and result output is “Hello World!”

– Right click on Sinple Project and select New –> Source Folder, type src/main/resources and click finish.

– Right click on src/main/resources and select New –> Other –> type folder and select Folder, input in Folder name: META-INF

– Right click on META-INF, select New –> Other –> XML file –> type persistence.xml and finish project. We have Project’s Structure:

maven project test

maven project test

2) Create java hibernate simple test project

pom.xml file to config get libraries on maven

 

– Modify persistence.xml file

Edit User.java entity

App.java function main to run

Run and output

In oracle, run select * from users

If we change connection to mongodb, we can review in Java hibernate and mongodb simple article.

Notes: base on this java hibernate simple project, we will research and practice many thing …

Tags: , , , ,

Related Posts

core java
Export Crystal Report with Subreport in java
core java
Convert xml to object java and vice versa
core java
Java basic tutorial on lvtutorial.com
core java
Java hibernate manytomany to manage user role

Related Posts

core java
Export Crystal Report with Subreport in java
core java
Convert xml to object java and vice versa
core java
Java basic tutorial on lvtutorial.com
core java
Java hibernate manytomany to manage user role

Leave a Reply

Your email address will not be published. Required fields are marked *