Hibernate standalone test application using JPA api to generate database schema and then persist and query an item.
Download jdbc driver (e.g. for PostgreSQL, see https://jdbc.postgresql.org/download.html) and run the database itself. The easiest way is probably with Docker
docker run -p 5432:5432 --rm -ePOSTGRES_USER=test -e POSTGRES_PASSWORD=test postgres:9.4 -c max-prepared-transactions=110 -c log-statement=all
If your database is running at different machine than at localhost:5432
or with different credentials than test/test
then consider to make changes in src/main/resources/persistence.xml
.
mvn clean package
java -cp target/hibernate-standalone-1.0-SNAPSHOT-jar-with-dependencies.jar:./postgresql-42.2.2.jar:. cz.chalda.Main