- Java: Version 17
- Maven: Make sure Maven is installed on your system. You can download it from here.
- Postgres DB
- Bibernate ORM
- Flyway
To start working on our project in the demo app, follow these steps:
-
Clone the Repository Bibernate app:
git clone https://github.com/Svydovets-Bobocode-Java-Ultimate-3-0/Bibernate.git cd Bibernate
-
Build the Project:
mvn clean install
-
Init DB configuration
By default use:
database : Postgres DB / database name : postgres / schema name : svydovets-demo
src/java/resources/db/migration/application.properties
db.url=jdbc:postgresql://localhost:5432/postgres?currentSchema=[SCHEMA]
db.user=[USER]
db.password=[PASSWORD]
- Init DB configuration in pom file from flyway migratioms
<build>
<plugins>
<plugin>
...
<configuration>
<driver>org.postgresql.Driver</driver>
<url>jdbc:postgresql://localhost:5432/</url>
<user>[USER]</user>
<password>[PASSWORD]</password>
<schemas>[SCHEMA]</schemas>
</configuration>
...
</plugin>
</plugins>
</build>
- Migrate data:
cd Bibernate
mvn flyway:migrate
- Run the application:
public class DemoApp {
public static void main(String[] args) {
SessionFactory sessionFactory = new SessionFactory();
Session session = sessionFactory.createSession();
...
session.close();
}
}
-
- Build the Demo Project:
mvn clean install
- Enjoy :)