Spring 3 Hibernate 4 Annotations Entity Manager PostgreSQL maven standalone example

Create the sample postgresql database at first in PgAdmin :
  1. CREATE DATABASE "TESTS"
  2. WITH OWNER = postgres
  3. ENCODING = 'UTF8'
  4. TABLESPACE = pg_default
  5. CONNECTION LIMIT = -1;

Then create the table in databse 'TESTS':
  1. CREATE TABLE USERS (
  2. ID serial NOT NULL,
  3. USERNAME text NOT NULL,
  4. NAME text NOT NULL
  5. );

Download the example from github.Build(mvn clean install) And run Main.java

No comments:

Post a Comment