wuyichen24 / jibernate

The JPA (Java Persistence API) module based on the Hibernate ORM framework with the enhanced and simplified query and expression modules.
Apache License 2.0
2 stars 1 forks source link

the skeleton for wiki #10

Open wuyichen24 opened 6 years ago

wuyichen24 commented 6 years ago
wuyichen24 commented 6 years ago

Build connection

This project currently only supports MySQL. More database suites will be added into this project.

This project is using jpropertiesorm to retrieve the parameters from the external configuration file and populate into the configuration class. For example:

MysqlDbConfig dbConfig   = new MysqlDbConfig("config/MysqlDb.properties").initialize();

After grabbing values from the external configuration file, you can pass the object of the configuration class into the constructor of the database-specific DAO (Data Access Object). This level of DAO is database-specific and you can also create an application DAO in the lower level for handling application-specific business logic.

MysqlEntityManagerDao dao = new MysqlEntityManagerDao(dbConfig);

After initializing this DAO, you can use it to execute CRUD operation.