Recently learning hibernate, the common tutorial is to go with MySQL, because the company's local computer with PG, so try to do a PG small demo. He is also learning to write, only to deepen the impression. Words do not say much, direct start;
A) Prepare the necessary documents and environment;
1) Local Installation PostgreSQL, this does not say, oneself to download online;
Note: PG 9.4 is used for this time
2) Download the JDBC Driver for PG;
Website: can fq point this download, cannot fq own Baidu bar.
To illustrate, there are 4 versions of the support pg9.4, depending on your JDK choice:
JDBC3 Postgresql Driver, Version 9.3-1103 (< jdk1.6)
JDBC4 Postgresql Driver, Version 9.4.1212 (= jdk1.6)
JDBC41 Postgresql Driver, Version 9.4.1212 (= jdk1.7)
JDBC42 Postgresql Driver, Version 9.4.1212 (= jdk1.8)
3) Download the Hibernate jar package;
Website: Fq Download (file is quite big, 248M); Since it is learning, it is directly on the latest version: 5.2.4.Final (2016-10-26)
Post-Unzip directory:
ii) departure;
1) PG Create a user feedback form (feedback);
Create TableFeedback (ID serial not NULL Primary Key, //serial is equivalent to the int auto_increment in MySQL, which achieves self-growth effect usernamevarchar( $) not NULL, Contentvarchar( $) not NULL, Sendtimetimestamp not NULL)
(... Not to be continued)
Hibetnate+postgresql First Experience and demo