Provider of dependencies needed to develop java application using maven profiles
This project has common code needed to start with any Java project using Hibernate and Spring. This can be used for both standalone as well web-applications.
In your project pom simply include this. (Note: this is not available in maven central. you will need to download this project and do mvn install)
<parent>
<groupId>com.naik</groupId>
<artifactId>hibspring</artifactId>
<version>5.5</version>
</parent>
Once you inlcude this pom as parent for your project, you will get many profiles to choose.
Profiles available:
- HibSpring-core
- json-tools
- mysql-db
- oracle-db
- spring-webmvc
- envers
- spring-boot-web
- spring-boot-soap-ws
HibSpring-core module has the class CustomHibernateDaoSupport.class which can be used to perform entity save, update, delete with database. Simply create a class variable of this and put @AutoWired and you will get all the APIs needed to interact with database.
Give your packages (comma separated) to scan by spring with VM-argument/System-variable - key is scan.packages
To give DB connection details and Entity classes for Hibernate, simply create config.properties and put in classpath. This file can have below properties.
jdbc.driverClassName=oracle.jdbc.OracleDriver
jdbc.url=jdbc:oracle:thin:naik_hibspring/root@localhost:1521:xe
jdbc.username=naik_hibspring
jdbc.password=root
#Hibernate configs
hibernate.dialect=org.hibernate.dialect.Oracle10gDialect
hibernate.show_sql=true
hibernate.hbm2ddl.auto=create
#Comma separated fully qualified class names which are annotated with @Entity
annotated.classes=
#Supported versions
This project has support for
- Hibernate4+Spring4 in v4.4 (branch Hib4Spring4-4.4)
- Hibernate5+Spring5 in v5.5 (branch master)