META-INF.pmptt.docs.how-to-integrate-rdbms.md Maven / Gradle / Ivy
# How to integrate to your application
Include PMPTT library in your Maven descriptor (`pom.xml`):
``` xml
one.edee.oss
pmptt_core
1.0.0
one.edee.oss
pmptt_rdbms
1.0.0
```
Or Gradle:
```
dependencies {
compile 'one.edee.oss:pmptt_core:1.0.0','one.edee.oss:pmptt_rdbms:1.0.0'
}
```
### Setup database schema
Create Spring Java configuration file:
``` java
@Configuration
@Import(PmpttSpringConfiguration.class)
public class DatabaseLayerConfig {
@Bean
public PMPTT pmptt(DataSource dataSource, PlatformTransactionManager transactionManager) {
return new PMPTT(
new MySqlStorage(dataSource, transactionManager)
);
}
@Bean
public Hierarchy categoryHierarchy(PMPTT pmptt) {
return pmptt.getOrCreateHierarchy("category", (short)10, (short)55);
}
}
```
© 2015 - 2024 Weber Informatics LLC | Privacy Policy