├── .editorconfig ├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.yaml │ ├── config.yml │ ├── new_feature.yaml │ └── other.yaml ├── release.yml ├── renovate.json └── workflows │ ├── central-sync.yml │ ├── graalvm-dev.yml │ ├── graalvm-latest.yml │ ├── gradle.yml │ ├── publish-snapshot.yml │ └── release.yml ├── .gitignore ├── ISSUE_TEMPLATE.md ├── LICENSE ├── MAINTAINING.md ├── README.md ├── SECURITY.md ├── build.gradle ├── buildSrc ├── build.gradle ├── settings.gradle └── src │ └── main │ └── groovy │ ├── io.micronaut.build.internal.sql-base.gradle │ ├── io.micronaut.build.internal.sql-module.gradle │ ├── io.micronaut.build.internal.test-application-hibernate6.gradle │ ├── io.micronaut.build.internal.test-application.gradle │ ├── io.micronaut.build.internal.test-library.gradle │ └── io.micronaut.build.internal.testing-base.gradle ├── config ├── HEADER ├── accepted-api-changes.json ├── checkstyle │ ├── checkstyle.xml │ └── suppressions.xml └── spotless.license.java ├── gradle.properties ├── gradle ├── libs.versions.toml ├── license.gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── hibernate-jpa ├── build.gradle └── src │ ├── main │ ├── java │ │ └── io │ │ │ └── micronaut │ │ │ └── configuration │ │ │ └── hibernate │ │ │ └── jpa │ │ │ ├── HibernateCurrentSessionContextClassProvider.java │ │ │ ├── JpaConfiguration.java │ │ │ ├── TransactionalSession.java │ │ │ ├── TransactionalSessionAdvice.java │ │ │ ├── TransactionalSessionInterceptor.java │ │ │ ├── conf │ │ │ ├── AbstractHibernateFactory.java │ │ │ ├── SessionFactoryPerDataSourceFactory.java │ │ │ ├── SessionFactoryPerJpaConfigurationFactory.java │ │ │ ├── serviceregistry │ │ │ │ └── builder │ │ │ │ │ ├── configures │ │ │ │ │ ├── StandardServiceRegistryBuilderConfigurer.java │ │ │ │ │ └── internal │ │ │ │ │ │ ├── CompileProxyConfigurer.java │ │ │ │ │ │ └── SettingsConfigurer.java │ │ │ │ │ └── supplier │ │ │ │ │ ├── StandardServiceRegistryBuilderCreator.java │ │ │ │ │ └── internal │ │ │ │ │ └── DefaultStandardServiceRegistryBuilderCreatorCreator.java │ │ │ ├── sessionfactory │ │ │ │ └── configure │ │ │ │ │ ├── SessionFactoryBuilderConfigurer.java │ │ │ │ │ └── internal │ │ │ │ │ ├── InterceptorConfigurer.java │ │ │ │ │ └── ValidatorFactoryConfigurer.java │ │ │ └── settings │ │ │ │ ├── SettingsSupplier.java │ │ │ │ └── internal │ │ │ │ ├── CurrentSessionContextClassSettingSupplier.java │ │ │ │ ├── DataSourceSettingSupplier.java │ │ │ │ ├── JCacheManagerSettingSupplier.java │ │ │ │ ├── MicronautContainerSettingsSupplier.java │ │ │ │ └── ValidatorFactorySettingSupplier.java │ │ │ ├── metrics │ │ │ ├── HibernateMetricsBinder.java │ │ │ └── package-info.java │ │ │ ├── package-info.java │ │ │ ├── proxy │ │ │ ├── GenerateProxy.java │ │ │ ├── IntroducedHibernateProxy.java │ │ │ ├── IntroducedHibernateProxyAdvice.java │ │ │ ├── IntroducedHibernateProxyFactory.java │ │ │ ├── IntroducedHibernateProxyFactoryFactory.java │ │ │ ├── IntroducedHibernateProxyLazyInitializer.java │ │ │ └── IntrospectedHibernateBytecodeProvider.java │ │ │ └── validation │ │ │ └── JPATraversableResolver.java │ └── resources │ │ └── META-INF │ │ └── native-image │ │ └── io.micronaut.sql │ │ └── hibernate-jpa-graal │ │ └── reflect-config.json │ └── test │ ├── groovy │ └── io │ │ └── micronaut │ │ └── configuration │ │ └── hibernate │ │ └── jpa │ │ ├── JavaBookService.java │ │ ├── JavaReadOnlyBookService.java │ │ ├── JpaConfigurationSpec.groovy │ │ ├── JpaSetupSpec.groovy │ │ ├── MultipleDataSourceJpaSetupSpec.groovy │ │ ├── MutipleDataSourceJavaService.java │ │ ├── datasources │ │ ├── CurrentSessionWithMultipleDataSourcesSpec.groovy │ │ ├── db1 │ │ │ ├── Product.java │ │ │ └── ProductRepository.java │ │ └── db2 │ │ │ ├── Bookstore.java │ │ │ ├── BookstoreMethodLevelTransaction.java │ │ │ └── BookstoreRepository.java │ │ ├── jcache │ │ ├── HibernateJCacheSetupSpec.groovy │ │ └── TestCachedEntity.java │ │ ├── mapping │ │ ├── Account.java │ │ ├── AccountRepository.java │ │ ├── CustomIndexesDatabaseObject.java │ │ └── MappingResourcesSpec.groovy │ │ ├── other │ │ └── Author.groovy │ │ └── proxy │ │ ├── CustomId.java │ │ ├── Customer.java │ │ ├── DepartmentCompositeId.java │ │ ├── DepartmentSimpleWithEquals.java │ │ ├── DepartmentSimpleWithoutEquals.java │ │ ├── EmbeddedData.java │ │ └── IntroduceHibernateProxySpec.groovy │ └── resources │ ├── hibernate │ └── custom.hbm.xml │ └── logback.xml ├── hibernate-reactive ├── build.gradle └── src │ ├── main │ └── java │ │ └── io │ │ └── micronaut │ │ └── configuration │ │ └── hibernate │ │ └── reactive │ │ └── conf │ │ ├── ExternalVertxSqlClientPoolSettingSupplier.java │ │ └── ReactiveRegistryCreator.java │ └── test │ ├── groovy │ └── io │ │ └── micronaut │ │ └── configuration │ │ └── hibernate │ │ └── reactive │ │ ├── datasources │ │ ├── CurrentSessionWithMultipleDataSourcesSpec.groovy │ │ ├── db1 │ │ │ ├── Product.java │ │ │ └── ProductRepository.java │ │ └── db2 │ │ │ ├── Bookstore.java │ │ │ ├── BookstoreMethodLevelTransaction.java │ │ │ └── BookstoreRepository.java │ │ └── multiple │ │ ├── MultipleDataSourceJpaSetupSpec.groovy │ │ ├── other │ │ └── Author.groovy │ │ └── xyz │ │ └── Book.groovy │ └── resources │ └── logback.xml ├── jasync-sql ├── build.gradle └── src │ ├── main │ └── java │ │ └── io │ │ └── micronaut │ │ └── configuration │ │ └── jasync │ │ ├── JasyncClientSettings.java │ │ ├── JasyncMySQLClientFactory.java │ │ ├── JasyncPoolConfiguration.java │ │ ├── JasyncPostgreSQLClientFactory.java │ │ ├── condition │ │ ├── RequiresJasyncClient.java │ │ └── package-info.java │ │ ├── health │ │ ├── JasyncHealthIndicator.java │ │ └── package-info.java │ │ └── package-info.java │ └── test │ ├── groovy │ └── io │ │ └── micronaut │ │ └── configuration │ │ └── jasync │ │ ├── ApplicationContextSpecification.groovy │ │ ├── ConfigurationFixture.groovy │ │ ├── JasyncConfigurationSpec.groovy │ │ ├── JasyncQueryInterceptorsSpec.groovy │ │ ├── JasyncSpec.groovy │ │ └── health │ │ └── JasyncHealthIndicatorSpec.groovy │ └── resources │ └── logback-test.xml ├── jdbc-dbcp ├── build.gradle └── src │ ├── main │ ├── java │ │ └── io │ │ │ └── micronaut │ │ │ └── configuration │ │ │ └── jdbc │ │ │ └── dbcp │ │ │ ├── DatasourceConfiguration.java │ │ │ ├── DatasourceFactory.java │ │ │ ├── metadata │ │ │ ├── DbcpDataSourcePoolMetadata.java │ │ │ └── package-info.java │ │ │ └── package-info.java │ └── resources │ │ └── META-INF │ │ └── native-image │ │ └── io.micronaut.sql │ │ └── jdbc-dbcp-graal │ │ └── resource-config.json │ └── test │ ├── groovy │ └── io │ │ └── micronaut │ │ └── configuration │ │ └── jdbc │ │ └── dbcp │ │ ├── BookService.java │ │ ├── DatasourceConfigurationSpec.groovy │ │ ├── DatasourceFactorySpec.groovy │ │ ├── DatasourceTransactionManagementSpec.groovy │ │ └── metadata │ │ ├── AbstractDataSourcePoolMetadataSpec.groovy │ │ ├── DbcpDataSourcePoolMetadataDisabledSpec.groovy │ │ └── DbcpDataSourcePoolMetadataSpec.groovy │ └── resources │ └── logback.xml ├── jdbc-hikari ├── build.gradle └── src │ ├── main │ └── java │ │ └── io │ │ └── micronaut │ │ └── configuration │ │ └── jdbc │ │ └── hikari │ │ ├── DatasourceConfiguration.java │ │ ├── DatasourceFactory.java │ │ ├── HikariUrlDataSource.java │ │ └── package-info.java │ └── test │ ├── groovy │ └── io │ │ └── micronaut │ │ └── configuration │ │ └── jdbc │ │ └── hikari │ │ ├── BookService.java │ │ ├── DatasourceConfigurationSpec.groovy │ │ ├── DatasourceFactorySpec.groovy │ │ ├── DatasourceTransactionManagementSpec.groovy │ │ └── metadata │ │ ├── AbstractDataSourcePoolMetadataSpec.groovy │ │ ├── DataSourcePoolMetadataSpec.groovy │ │ ├── HikariDataSourcePoolMetadataCustomPoolSpec.groovy │ │ └── HikariDataSourcePoolMetadataDisabledSpec.groovy │ └── resources │ └── logback.xml ├── jdbc-tomcat ├── build.gradle └── src │ ├── main │ ├── java │ │ └── io │ │ │ └── micronaut │ │ │ └── configuration │ │ │ └── jdbc │ │ │ └── tomcat │ │ │ ├── DatasourceConfiguration.java │ │ │ ├── DatasourceFactory.java │ │ │ ├── metadata │ │ │ ├── TomcatDataSourcePoolMetadata.java │ │ │ └── package-info.java │ │ │ └── package-info.java │ └── resources │ │ └── META-INF │ │ └── native-image │ │ └── io.micronaut.sql │ │ └── jdbc-tomcat-graal │ │ └── proxy-config.json │ └── test │ ├── groovy │ └── io │ │ └── micronaut │ │ └── configuration │ │ └── jdbc │ │ └── tomcat │ │ ├── BookService.java │ │ ├── DatasourceConfigurationSpec.groovy │ │ ├── DatasourceFactorySpec.groovy │ │ ├── DatasourceTransactionManagementSpec.groovy │ │ └── metadata │ │ ├── AbstractDataSourcePoolMetadataSpec.groovy │ │ ├── TomcatDataSourcePoolMetadataDisabledSpec.groovy │ │ └── TomcatDataSourcePoolMetadataSpec.groovy │ └── resources │ └── logback.xml ├── jdbc-ucp ├── build.gradle └── src │ ├── main │ └── java │ │ └── io │ │ └── micronaut │ │ └── configuration │ │ └── jdbc │ │ └── ucp │ │ ├── ConnectionPoolManagerListener.java │ │ ├── DatasourceConfiguration.java │ │ ├── DatasourceFactory.java │ │ ├── OracleUcpConfiguration.java │ │ ├── OracleUcpConfigurator.java │ │ ├── UniversalConnectionPoolManagerConfiguration.java │ │ ├── UniversalConnectionPoolManagerFactory.java │ │ └── package-info.java │ └── test │ ├── groovy │ └── io │ │ └── micronaut │ │ └── configuration │ │ └── jdbc │ │ └── ucp │ │ ├── DatasourceConfigurationSpec.groovy │ │ ├── UniversalConnectionPoolManagerConfigurationSpec.groovy │ │ └── UniversalConnectionPoolManagerFactorySpec.groovy │ └── resources │ └── logback.xml ├── jdbc ├── build.gradle └── src │ ├── main │ ├── java │ │ └── io │ │ │ └── micronaut │ │ │ └── jdbc │ │ │ ├── BasicJdbcConfiguration.java │ │ │ ├── CalculatedSettings.java │ │ │ ├── DataSourceResolver.java │ │ │ ├── JdbcDataSourceEnabled.java │ │ │ ├── JdbcDatabaseManager.java │ │ │ ├── metadata │ │ │ ├── AbstractDataSourcePoolMetadata.java │ │ │ ├── DataSourcePoolMetadata.java │ │ │ ├── DataSourcePoolMetadataProvider.java │ │ │ └── package-info.java │ │ │ └── package-info.java │ └── resources │ │ └── META-INF │ │ └── native-image │ │ └── io.micronaut.sql │ │ └── micronaut-jdbc │ │ ├── native-image.properties │ │ └── reflect-config.json │ └── test │ ├── groovy │ └── io │ │ └── micronaut │ │ └── jdbc │ │ └── CalculatedSettingsSpec.groovy │ └── resources │ ├── h2.jar │ ├── logback.xml │ └── mysql.jar ├── jdbi ├── build.gradle └── src │ ├── main │ └── java │ │ └── io │ │ └── micronaut │ │ └── configuration │ │ └── jdbi │ │ ├── JdbiCustomizer.java │ │ ├── JdbiFactory.java │ │ ├── package-info.java │ │ └── transaction │ │ ├── AbstractTransactionHandler.java │ │ ├── micronaut │ │ └── MicronautDataTransactionHandler.java │ │ ├── package-info.java │ │ └── spring │ │ ├── SpringTransactionHandler.java │ │ └── package-info.java │ ├── test │ ├── groovy │ │ └── io │ │ │ └── micronaut │ │ │ └── configuration │ │ │ └── jdbi │ │ │ ├── DataSourceTransactionManagerFactory.java │ │ │ ├── JdbiSpec.groovy │ │ │ ├── TestInterface.java │ │ │ ├── TestJdbiCustomizer.java │ │ │ └── TestService.java │ └── resources │ │ └── logback.xml │ └── txTest │ └── groovy │ └── io │ └── micronaut │ └── configuration │ └── jdbi │ ├── TxJdbiSpec.groovy │ ├── TxTestService.java │ └── example │ ├── ApplicationSpec.groovy │ ├── DatabaseSetup.java │ ├── dao │ ├── BookMapper.java │ ├── BooksDao.java │ └── DaoFactory.java │ ├── jdbitransaction │ └── ConcurrentTransactionsBug.java │ └── model │ └── Book.java ├── jooq ├── build.gradle └── src │ ├── main │ ├── java │ │ └── io │ │ │ └── micronaut │ │ │ └── configuration │ │ │ └── jooq │ │ │ ├── AbstractJooqConfigurationFactory.java │ │ │ ├── AbstractJooqConfigurationProperties.java │ │ │ ├── DSLContextFactory.java │ │ │ ├── JooqConfigurationFactory.java │ │ │ ├── JooqConfigurationProperties.java │ │ │ ├── JsonConverterProvider.java │ │ │ ├── MicronautTransaction.java │ │ │ ├── MicronautTransactionProvider.java │ │ │ ├── R2dbcJooqConfigurationFactory.java │ │ │ ├── R2dbcJooqConfigurationProperties.java │ │ │ ├── package-info.java │ │ │ └── spring │ │ │ ├── JooqExceptionTranslator.java │ │ │ ├── JooqExceptionTranslatorProvider.java │ │ │ ├── SpringTransaction.java │ │ │ ├── SpringTransactionProvider.java │ │ │ └── package-info.java │ └── resources │ │ └── META-INF │ │ └── native-image │ │ └── io.micronaut.sql │ │ └── jooq-graal │ │ └── native-image.properties │ ├── test │ ├── groovy │ │ └── io │ │ │ └── micronaut │ │ │ └── configuration │ │ │ └── jooq │ │ │ ├── ConverterProviderSpec.groovy │ │ │ ├── CustomConverterProvider.java │ │ │ ├── JsonConverterSpec.groovy │ │ │ ├── TestObject.java │ │ │ ├── TestService.java │ │ │ └── spring │ │ │ ├── DataSourceTransactionManagerFactory.java │ │ │ └── DslContextSpec.groovy │ └── resources │ │ └── logback.xml │ └── txTest │ ├── groovy │ └── io │ │ └── micronaut │ │ └── configuration │ │ └── jooq │ │ ├── TxDslContextSpec.groovy │ │ └── TxTestService.java │ └── resources │ └── logback.xml ├── settings.gradle ├── sql-bom └── build.gradle ├── src └── main │ └── docs │ └── guide │ ├── breaks.adoc │ ├── hibernate.adoc │ ├── hibernate │ ├── hibernate-customizing.adoc │ ├── hibernate-disable.adoc │ ├── hibernate-entity-scan.adoc │ ├── hibernate-inject-session.adoc │ ├── hibernate-lazy-initialization.adoc │ ├── hibernate-proxies.adoc │ └── hibernate-reactive.adoc │ ├── introduction.adoc │ ├── jasync.adoc │ ├── jasync │ ├── jasync-client.adoc │ └── jasync-healthchecks.adoc │ ├── jdbc.adoc │ ├── jdbc │ ├── jdbc-connection-pools.adoc │ ├── jdbc-disable.adoc │ ├── jdbc-healthchecks.adoc │ └── jdbc-multiple-datasources.adoc │ ├── jdbi.adoc │ ├── jdbi │ └── jdbi-provider-beans.adoc │ ├── jooq.adoc │ ├── jooq │ ├── jooq-dialect.adoc │ ├── jooq-graalvm.adoc │ ├── jooq-jsonb.adoc │ └── jooq-provider-beans.adoc │ ├── releaseHistory.adoc │ ├── repository.adoc │ ├── toc.yml │ ├── vertxmysqlclient.adoc │ ├── vertxmysqlclient │ └── vertxmysqlclient-healthchecks.adoc │ ├── vertxpgclient.adoc │ └── vertxpgclient │ └── vertxpgclient-healthchecks.adoc ├── tests ├── common-reactive │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── example │ │ └── reactive │ │ ├── DestroyController.java │ │ ├── IOwnerRepository.java │ │ ├── IPetRepository.java │ │ ├── InitController.java │ │ ├── Mapper.java │ │ ├── OwnerController.java │ │ └── PetController.java ├── common-sync │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── example │ │ └── sync │ │ ├── DestroyController.java │ │ ├── IOwnerRepository.java │ │ ├── IPetRepository.java │ │ ├── InitController.java │ │ ├── Mapper.java │ │ ├── OwnerController.java │ │ └── PetController.java ├── common-tests │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── example │ │ └── sync │ │ └── AbstractApp.java ├── common │ ├── build.gradle │ └── src │ │ └── main │ │ ├── java │ │ └── example │ │ │ ├── Application.java │ │ │ ├── domain │ │ │ ├── IOwner.java │ │ │ └── IPet.java │ │ │ └── dto │ │ │ ├── OwnerDto.java │ │ │ └── PetDto.java │ │ └── resources │ │ └── application.yml ├── hibernate6 │ ├── hibernate6-h2 │ │ ├── build.gradle │ │ └── src │ │ │ └── test │ │ │ ├── java │ │ │ └── example │ │ │ │ └── hibernate6 │ │ │ │ └── sync │ │ │ │ └── H2App.java │ │ │ └── resources │ │ │ └── logback.xml │ ├── hibernate6-mariadb │ │ ├── build.gradle │ │ └── src │ │ │ └── test │ │ │ ├── java │ │ │ └── example │ │ │ │ └── hibernate6 │ │ │ │ └── sync │ │ │ │ └── MariaDBApp.java │ │ │ └── resources │ │ │ └── logback.xml │ ├── hibernate6-mssql │ │ ├── build.gradle │ │ └── src │ │ │ └── test │ │ │ ├── java │ │ │ └── example │ │ │ │ └── hibernate6 │ │ │ │ └── sync │ │ │ │ └── MSSQLApp.java │ │ │ └── resources │ │ │ ├── application-test.yml │ │ │ └── logback.xml │ ├── hibernate6-mysql-disabled │ │ ├── build.gradle │ │ └── src │ │ │ ├── main │ │ │ └── resources │ │ │ │ └── application.properties │ │ │ └── test │ │ │ ├── java │ │ │ └── example │ │ │ │ └── hibernate6 │ │ │ │ └── sync │ │ │ │ └── TempTest.java │ │ │ └── resources │ │ │ └── logback.xml │ ├── hibernate6-mysql │ │ ├── build.gradle │ │ └── src │ │ │ └── test │ │ │ ├── java │ │ │ └── example │ │ │ │ └── hibernate6 │ │ │ │ └── sync │ │ │ │ ├── DisabledDbAppTest.java │ │ │ │ └── MySQLApp.java │ │ │ └── resources │ │ │ └── logback.xml │ ├── hibernate6-oracle │ │ ├── build.gradle │ │ └── src │ │ │ └── test │ │ │ ├── java │ │ │ └── example │ │ │ │ └── hibernate6 │ │ │ │ └── sync │ │ │ │ └── OracleDBApp.java │ │ │ └── resources │ │ │ └── logback.xml │ ├── hibernate6-postgres │ │ ├── build.gradle │ │ └── src │ │ │ └── test │ │ │ ├── java │ │ │ └── example │ │ │ │ └── hibernate6 │ │ │ │ └── sync │ │ │ │ └── PostgresApp.java │ │ │ └── resources │ │ │ └── logback.xml │ ├── hibernate6-reactive-common │ │ ├── build.gradle │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── example │ │ │ │ └── hibernate6 │ │ │ │ └── reactive │ │ │ │ ├── Owner.java │ │ │ │ ├── OwnerRepository.java │ │ │ │ ├── Pet.java │ │ │ │ ├── PetRepository.java │ │ │ │ └── TxManager.java │ │ │ └── resources │ │ │ └── application.yml │ ├── hibernate6-reactive-mssql │ │ ├── build.gradle │ │ └── src │ │ │ └── test │ │ │ ├── java │ │ │ └── example │ │ │ │ └── hibernate6 │ │ │ │ └── reactive │ │ │ │ └── MSSQLApp.java │ │ │ └── resources │ │ │ ├── application-test.yml │ │ │ └── logback.xml │ ├── hibernate6-reactive-mysql │ │ ├── build.gradle │ │ └── src │ │ │ └── test │ │ │ ├── java │ │ │ └── example │ │ │ │ └── hibernate6 │ │ │ │ └── reactive │ │ │ │ └── MySQLApp.java │ │ │ └── resources │ │ │ └── logback.xml │ ├── hibernate6-reactive-oracle │ │ ├── build.gradle │ │ └── src │ │ │ └── test │ │ │ ├── java │ │ │ └── example │ │ │ │ └── hibernate6 │ │ │ │ └── reactive │ │ │ │ └── OracleDBApp.java │ │ │ └── resources │ │ │ └── logback.xml │ ├── hibernate6-reactive-postgres │ │ ├── build.gradle │ │ └── src │ │ │ └── test │ │ │ ├── java │ │ │ └── example │ │ │ │ └── hibernate6 │ │ │ │ └── reactive │ │ │ │ └── PostgresApp.java │ │ │ └── resources │ │ │ └── logback.xml │ └── hibernate6-sync-common │ │ ├── build.gradle │ │ └── src │ │ └── main │ │ ├── java │ │ └── example │ │ │ └── hibernate6 │ │ │ └── sync │ │ │ ├── Owner.java │ │ │ ├── OwnerRepository.java │ │ │ ├── Pet.java │ │ │ ├── PetRepository.java │ │ │ └── TestController.java │ │ └── resources │ │ └── application.yml ├── jdbc-dbcp-tests │ └── jdbc-dbcp-postgres │ │ ├── build.gradle │ │ └── src │ │ ├── main │ │ └── java │ │ │ └── example │ │ │ └── jdbc │ │ │ └── ucp │ │ │ └── sync │ │ │ ├── Owner.java │ │ │ ├── OwnerRepository.java │ │ │ ├── Pet.java │ │ │ └── PetRepository.java │ │ └── test │ │ └── java │ │ └── example │ │ └── jdbc │ │ └── ucp │ │ └── sync │ │ └── PostgresApp.java ├── jdbc-tomcat-tests │ └── jdbc-tomcat-mysql │ │ ├── build.gradle │ │ └── src │ │ ├── main │ │ └── java │ │ │ └── example │ │ │ └── jdbc │ │ │ └── tomcat │ │ │ └── sync │ │ │ ├── Owner.java │ │ │ ├── OwnerRepository.java │ │ │ ├── Pet.java │ │ │ └── PetRepository.java │ │ └── test │ │ └── java │ │ └── example │ │ └── jdbc │ │ └── tomcat │ │ └── sync │ │ └── MySQLApp.java ├── jdbc-ucp-tests │ └── jdbc-ucp-oracle │ │ ├── build.gradle │ │ └── src │ │ ├── main │ │ └── java │ │ │ └── example │ │ │ └── jdbc │ │ │ └── ucp │ │ │ └── sync │ │ │ ├── Owner.java │ │ │ ├── OwnerRepository.java │ │ │ ├── Pet.java │ │ │ └── PetRepository.java │ │ └── test │ │ ├── java │ │ └── example │ │ │ └── jdbc │ │ │ └── ucp │ │ │ └── sync │ │ │ ├── DisabledDbAppTest.java │ │ │ └── OracleApp.java │ │ └── resources │ │ └── logback.xml └── jooq-tests │ ├── jooq-jdbc-postgres │ ├── build.gradle │ └── src │ │ ├── main │ │ └── java │ │ │ └── example │ │ │ └── jooq │ │ │ └── sync │ │ │ ├── Owner.java │ │ │ ├── OwnerRepository.java │ │ │ ├── Pet.java │ │ │ └── PetRepository.java │ │ └── test │ │ ├── java │ │ └── example │ │ │ └── jooq │ │ │ └── sync │ │ │ ├── DisabledDbAppTest.java │ │ │ └── PostgresApp.java │ │ └── resources │ │ └── logback.xml │ └── jooq-r2dbc-postgres │ ├── build.gradle │ └── src │ ├── main │ └── java │ │ └── example │ │ └── jooq │ │ └── reactive │ │ ├── AbstractRepository.java │ │ ├── Owner.java │ │ ├── OwnerRepository.java │ │ ├── Pet.java │ │ └── PetRepository.java │ └── test │ ├── java │ └── example │ │ └── jooq │ │ └── reactive │ │ └── PostgresApp.java │ └── resources │ └── logback.xml ├── vertx-mysql-client ├── build.gradle └── src │ ├── main │ └── java │ │ └── io │ │ └── micronaut │ │ └── configuration │ │ └── vertx │ │ └── mysql │ │ └── client │ │ ├── MySQLClientConfiguration.java │ │ ├── MySQLClientFactory.java │ │ ├── MySQLClientSettings.java │ │ ├── MySQLDriverFactory.java │ │ ├── condition │ │ └── RequiresVertxMySQLClient.java │ │ ├── health │ │ ├── MySQLHealthIndicator.java │ │ └── package-info.java │ │ └── package-info.java │ └── test │ ├── groovy │ └── io │ │ └── micronaut │ │ └── configuration │ │ └── vertx │ │ └── mysql │ │ └── client │ │ ├── MySQLClientSpec.groovy │ │ ├── MySQLConfigurationSpec.groovy │ │ └── health │ │ └── MySQLPoolHealthIndicatorSpec.groovy │ └── resources │ └── logback-test.xml └── vertx-pg-client ├── build.gradle └── src ├── main └── java │ └── io │ └── micronaut │ └── configuration │ └── vertx │ └── pg │ └── client │ ├── PgClientConfiguration.java │ ├── PgClientFactory.java │ ├── PgClientSettings.java │ ├── PgDriverFactory.java │ ├── condition │ └── RequiresVertxPgClient.java │ ├── health │ ├── PgHealthIndicator.java │ └── package-info.java │ └── package-info.java └── test ├── groovy └── io │ └── micronaut │ └── configuration │ └── vertx │ └── pg │ └── client │ ├── PgClientConfigurationSpec.groovy │ ├── PgClientSpec.groovy │ └── health │ └── PgClientHealthIndicatorSpec.groovy └── resources └── logback-test.xml /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | trim_trailing_whitespace = true 5 | insert_final_newline = true 6 | charset = utf-8 7 | indent_style = space 8 | 9 | [{*.sh,gradlew}] 10 | end_of_line = lf 11 | 12 | [{*.bat,*.cmd}] 13 | end_of_line = crlf 14 | 15 | [{*.mustache,*.ftl}] 16 | insert_final_newline = false 17 | 18 | [*.java] 19 | indent_size = 4 20 | tab_width = 4 21 | max_line_length = 100 22 | # Import order can be configured with ij_java_imports_layout=... 23 | # See documentation https://youtrack.jetbrains.com/issue/IDEA-170643#focus=streamItem-27-3708697.0-0 24 | 25 | [*.xml] 26 | indent_size = 4 27 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | *.java text eol=lf 5 | *.groovy text eol=lf 6 | *.html text eol=lf 7 | *.kt text eol=lf 8 | *.kts text eol=lf 9 | *.md text diff=markdown eol=lf 10 | *.py text diff=python executable 11 | *.pl text diff=perl executable 12 | *.pm text diff=perl 13 | *.css text diff=css eol=lf 14 | *.js text eol=lf 15 | *.sql text eol=lf 16 | *.q text eol=lf 17 | 18 | *.sh text eol=lf 19 | gradlew text eol=lf 20 | 21 | *.bat text eol=crlf 22 | *.cmd text eol=crlf 23 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | contact_links: 2 | - name: Micronaut Core Discussions 3 | url: https://github.com/micronaut-projects/micronaut-core/discussions 4 | about: Ask questions about Micronaut on Github 5 | - name: Micronaut Data Discussions 6 | url: https://github.com/micronaut-projects/micronaut-data/discussions 7 | about: Ask Micronaut Data related questions on Github 8 | - name: Stack Overflow 9 | url: https://stackoverflow.com/tags/micronaut 10 | about: Ask questions on Stack Overflow 11 | - name: Chat 12 | url: https://gitter.im/micronautfw/ 13 | about: Chat with us on Gitter. -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/new_feature.yaml: -------------------------------------------------------------------------------- 1 | name: Feature request 2 | description: Create a new feature request 3 | body: 4 | - type: markdown 5 | attributes: 6 | value: | 7 | Please describe the feature you want for Micronaut to implement, before that check if there is already an existing issue to add it. 8 | - type: textarea 9 | attributes: 10 | label: Feature description 11 | placeholder: Tell us what feature you would like for Micronaut to have and what problem is it going to solve 12 | validations: 13 | required: true 14 | 15 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/other.yaml: -------------------------------------------------------------------------------- 1 | name: Other 2 | description: Something different 3 | body: 4 | - type: textarea 5 | attributes: 6 | label: Issue description 7 | validations: 8 | required: true 9 | 10 | -------------------------------------------------------------------------------- /.github/release.yml: -------------------------------------------------------------------------------- 1 | changelog: 2 | exclude: 3 | authors: 4 | - micronaut-build 5 | categories: 6 | - title: Breaking Changes 🛠 7 | labels: 8 | - 'type: breaking' 9 | - title: New Features 🎉 10 | labels: 11 | - 'type: enhancement' 12 | - title: Bug Fixes 🐞 13 | labels: 14 | - 'type: bug' 15 | - title: Improvements ⭐ 16 | labels: 17 | - 'type: improvement' 18 | - title: Docs 📖 19 | labels: 20 | - 'type: docs' 21 | - title: Dependency updates 🚀 22 | labels: 23 | - 'type: dependency-upgrade' 24 | - 'dependency-upgrade' 25 | - title: Regressions 🧐 26 | labels: 27 | - 'type: regression' 28 | - title: GraalVM 🏆 29 | labels: 30 | - 'relates-to: graal' 31 | - title: Other Changes 💡 32 | labels: 33 | - "*" 34 | -------------------------------------------------------------------------------- /.github/renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "config:recommended" 4 | ], 5 | "addLabels": [ 6 | "type: dependency-upgrade" 7 | ], 8 | "schedule": [ 9 | "after 10pm" 10 | ], 11 | "prHourlyLimit": 1, 12 | "prConcurrentLimit": 20, 13 | "timezone": "Europe/Prague", 14 | "packageRules": [ 15 | { 16 | "dependencyDashboardApproval": true, 17 | "matchUpdateTypes": [ 18 | "patch" 19 | ], 20 | "matchCurrentVersion": "!/^0/", 21 | "automerge": true, 22 | "matchPackageNames": [ 23 | "/actions.*/" 24 | ] 25 | }, 26 | { 27 | "matchUpdateTypes": [ 28 | "patch" 29 | ], 30 | "matchCurrentVersion": "!/^0/", 31 | "automerge": true 32 | } 33 | ] 34 | } 35 | -------------------------------------------------------------------------------- /.github/workflows/publish-snapshot.yml: -------------------------------------------------------------------------------- 1 | # WARNING: Do not edit this file directly. Instead, go to: 2 | # 3 | # https://github.com/micronaut-projects/micronaut-project-template/tree/master/.github/workflows 4 | # 5 | # and edit them there. Note that it will be sync'ed to all the Micronaut repos 6 | name: Publish snapshot release 7 | on: [workflow_dispatch] 8 | jobs: 9 | build: 10 | if: github.repository != 'micronaut-projects/micronaut-project-template' 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v4 14 | - uses: actions/cache@v4 15 | with: 16 | path: ~/.gradle/caches 17 | key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} 18 | restore-keys: | 19 | ${{ runner.os }}-gradle- 20 | - name: Set up JDK 21 | uses: actions/setup-java@v4 22 | with: 23 | distribution: 'temurin' 24 | java-version: '17' 25 | - name: Publish to Sonatype Snapshots 26 | if: success() 27 | env: 28 | SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} 29 | SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} 30 | DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} 31 | DEVELOCITY_CACHE_USERNAME: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USERNAME }} 32 | DEVELOCITY_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }} 33 | run: ./gradlew publishToSonatype --no-daemon 34 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | .DS_Store 3 | target/ 4 | .gradle/ 5 | .idea/ 6 | build/ 7 | !build-logic/src/main/java/io/micronaut/build 8 | classes/ 9 | out/ 10 | *.db 11 | *.log 12 | *.iml 13 | .classpath 14 | .factorypath 15 | bin/ 16 | .settings/ 17 | .project 18 | */test/ 19 | */META-INF/ 20 | *.ipr 21 | *.iws 22 | .kotlintest 23 | */.kotlintest/ 24 | 25 | # ignore resources, are downloaded via a gradle task from micronaut_docs 26 | src/main/docs/resources/css/highlight/*.css 27 | src/main/docs/resources/css/highlight/*.png 28 | src/main/docs/resources/css/highlight/*.jpg 29 | src/main/docs/resources/css/*.css 30 | src/main/docs/resources/js/*.js 31 | src/main/docs/resources/style/*.html 32 | src/main/docs/resources/img/micronaut-logo-white.svg 33 | 34 | # Ignore files generated by test-resources 35 | **/.micronaut/test-resources/ 36 | -------------------------------------------------------------------------------- /ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Thanks for reporting an issue, please review the task list below before submitting the 2 | issue. Your issue report will be closed if the issue is incomplete and the below tasks not completed. 3 | 4 | NOTE: If you are unsure about something and the issue is more of a question a better place to ask questions is on Stack Overflow (https://stackoverflow.com/tags/micronaut) or Gitter (https://gitter.im/micronautfw/). DO NOT use the issue tracker to ask questions. 5 | 6 | ### Task List 7 | 8 | - [ ] Steps to reproduce provided 9 | - [ ] Stacktrace (if present) provided 10 | - [ ] Example that reproduces the problem uploaded to Github 11 | - [ ] Full description of the issue provided (see below) 12 | 13 | ### Steps to Reproduce 14 | 15 | 1. TODO 16 | 2. TODO 17 | 3. TODO 18 | 19 | ### Expected Behaviour 20 | 21 | Tell us what should happen 22 | 23 | ### Actual Behaviour 24 | 25 | Tell us what happens instead 26 | 27 | ### Environment Information 28 | 29 | - **Operating System**: TODO 30 | - **Micronaut Version:** TODO 31 | - **JDK Version:** TODO 32 | 33 | ### Example Application 34 | 35 | - TODO: link to github repository with example that reproduces the issue 36 | 37 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | We release patches for security vulnerabilities. Which versions are eligible 4 | receiving such patches depend on the CVSS v3.0 Rating: 5 | 6 | | CVSS v3.0 | Supported Versions | 7 | |-----------|-------------------------------------------| 8 | | 9.0-10.0 | Releases within the previous three months | 9 | | 4.0-8.9 | Most recent release | 10 | 11 | ## Reporting a Vulnerability 12 | 13 | Please responsibly disclose (suspected) security vulnerabilities to 14 | **[The Micronaut Foundation](foundation@micronaut.io)**. You will receive a response from 15 | us within 48 hours. If the issue is confirmed, we will release a patch as soon 16 | as possible depending on complexity but historically within a few days. 17 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "io.micronaut.build.internal.docs" 3 | id "io.micronaut.build.internal.quality-reporting" 4 | } 5 | 6 | repositories { 7 | mavenCentral() 8 | } 9 | 10 | if (System.getenv("SONAR_TOKEN") != null) { 11 | sonarqube { 12 | properties { 13 | property "sonar.exclusions", "**/example/**" 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /buildSrc/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'groovy-gradle-plugin' 3 | } 4 | 5 | repositories { 6 | gradlePluginPortal() 7 | mavenCentral() 8 | } 9 | 10 | dependencies { 11 | implementation libs.gradle.micronaut 12 | implementation(libs.sonatype.scan) 13 | } 14 | -------------------------------------------------------------------------------- /buildSrc/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'sql-parent' 2 | dependencyResolutionManagement { 3 | versionCatalogs { 4 | libs { 5 | from(files("../gradle/libs.versions.toml")) 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /buildSrc/src/main/groovy/io.micronaut.build.internal.sql-base.gradle: -------------------------------------------------------------------------------- 1 | repositories { 2 | mavenCentral() 3 | } 4 | 5 | dependencies { 6 | testImplementation mnSerde.micronaut.serde.jackson 7 | } 8 | -------------------------------------------------------------------------------- /buildSrc/src/main/groovy/io.micronaut.build.internal.sql-module.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'io.micronaut.build.internal.module' 3 | id 'io.micronaut.build.internal.sql-base' 4 | id("org.sonatype.gradle.plugins.scan") 5 | } 6 | String ossIndexUsername = System.getenv("OSS_INDEX_USERNAME") ?: project.properties["ossIndexUsername"] 7 | String ossIndexPassword = System.getenv("OSS_INDEX_PASSWORD") ?: project.properties["ossIndexPassword"] 8 | boolean sonatypePluginConfigured = ossIndexUsername != null && ossIndexPassword != null 9 | if (sonatypePluginConfigured) { 10 | ossIndexAudit { 11 | username = ossIndexUsername 12 | password = ossIndexPassword 13 | excludeCoordinates = [ 14 | "com.h2database:h2:2.3.232" // no version patched https://ossindex.sonatype.org/component/pkg:maven/com.h2database/h2 15 | ] 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /buildSrc/src/main/groovy/io.micronaut.build.internal.test-application-hibernate6.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'io.micronaut.build.internal.test-application' 3 | } 4 | dependencies { 5 | testImplementation(mnData.micronaut.data.tx.hibernate) 6 | } 7 | -------------------------------------------------------------------------------- /buildSrc/src/main/groovy/io.micronaut.build.internal.test-application.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'io.micronaut.build.internal.testing-base' 3 | id 'io.micronaut.application' 4 | id 'io.micronaut.test-resources' 5 | } 6 | 7 | micronaut { 8 | importMicronautPlatform = false 9 | runtime "netty" 10 | testRuntime "junit" 11 | testResources { 12 | clientTimeout = 180 13 | version = libs.versions.micronaut.test.resources.get() 14 | } 15 | } 16 | 17 | dependencies { 18 | runtimeOnly mnLogging.logback.classic 19 | implementation mn.micronaut.http.client 20 | testImplementation mnTest.micronaut.test.core 21 | testImplementation(mnTestResources.testcontainers.jdbc) 22 | 23 | micronautBoms(platform(mn.micronaut.core.bom)) 24 | micronautBoms(platform(mnData.micronaut.data.bom)) 25 | } 26 | 27 | application { 28 | mainClass = "example.Application" 29 | } 30 | 31 | configurations.all { 32 | resolutionStrategy.preferProjectModules() 33 | } 34 | 35 | graalvmNative { 36 | toolchainDetection = false 37 | binaries { 38 | all { 39 | buildArgs.add("--report-unsupported-elements-at-runtime") 40 | } 41 | } 42 | metadataRepository { 43 | enabled = true 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /buildSrc/src/main/groovy/io.micronaut.build.internal.test-library.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'io.micronaut.build.internal.testing-base' 3 | id 'io.micronaut.minimal.library' 4 | } 5 | 6 | micronaut { 7 | importMicronautPlatform = false 8 | } 9 | 10 | dependencies { 11 | micronautBoms(platform(mnData.micronaut.data.bom)) 12 | } 13 | -------------------------------------------------------------------------------- /buildSrc/src/main/groovy/io.micronaut.build.internal.testing-base.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java' 3 | id 'jacoco' 4 | id 'io.micronaut.build.internal.sql-base' 5 | } 6 | 7 | group "io.micronaut.example" 8 | 9 | tasks.register("testExamples") { 10 | dependsOn "test" 11 | } 12 | -------------------------------------------------------------------------------- /config/HEADER: -------------------------------------------------------------------------------- 1 | Copyright ${year} original authors 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | https://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /config/accepted-api-changes.json: -------------------------------------------------------------------------------- 1 | [ 2 | 3 | ] 4 | -------------------------------------------------------------------------------- /config/checkstyle/suppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /config/spotless.license.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-$YEAR original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | projectVersion=6.1.2-SNAPSHOT 2 | projectGroup=io.micronaut.sql 3 | 4 | title=Micronaut SQL Libraries 5 | projectDesc=Projects to support SQL Database access in Micronaut 6 | projectUrl=https://micronaut.io 7 | githubSlug=micronaut-projects/micronaut-sql 8 | developers=Graeme Rocher 9 | 10 | 11 | hibernateapi=https://docs.jboss.org/hibernate/orm/current/javadocs 12 | jdkapi=https://docs.oracle.com/en/java/javase/17/docs/api 13 | jooqapi=https://www.jooq.org/javadoc/latest 14 | jdbiapi=https://jdbi.org/apidocs 15 | 16 | org.gradle.caching=true 17 | org.gradle.jvmargs=-Xmx2048M 18 | -------------------------------------------------------------------------------- /gradle/license.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.github.hierynomus.license' 2 | 3 | license { 4 | header = rootProject.file('config/HEADER') 5 | strictCheck = true 6 | ignoreFailures = true 7 | mapping { 8 | kt = 'SLASHSTAR_STYLE' 9 | java = 'SLASHSTAR_STYLE' 10 | groovy = 'SLASHSTAR_STYLE' 11 | } 12 | ext.year = '2017-2020' 13 | 14 | exclude "**/transaction/**" 15 | exclude '**/*.txt' 16 | exclude '**/*.html' 17 | exclude '**/*.xml' 18 | exclude '**/*.json' 19 | exclude '**/build-info.properties' 20 | exclude '**/git.properties' 21 | exclude '**/othergit.properties' 22 | } 23 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/micronaut-projects/micronaut-sql/4bef137057148827b121cbefee306be3dfbdaa1f/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /hibernate-jpa/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'io.micronaut.build.internal.sql-module' 3 | } 4 | 5 | dependencies { 6 | annotationProcessor(mn.micronaut.graal) 7 | 8 | api(libs.managed.hibernate.core) 9 | api(libs.managed.jakarta.transaction.api) 10 | api(mnValidation.micronaut.validation) 11 | compileOnly(mnData.micronaut.data.tx.hibernate) 12 | testImplementation(mnData.micronaut.data.tx.hibernate) 13 | api(mn.micronaut.aop) 14 | api projects.micronautJdbc 15 | 16 | compileOnly(libs.managed.hibernate.micrometer) 17 | compileOnly(libs.managed.hibernate.jcache) 18 | compileOnly(mn.micronaut.management) 19 | compileOnly(mnMicrometer.micronaut.micrometer.core) 20 | 21 | testAnnotationProcessor(mn.micronaut.inject.java) 22 | testImplementation(mn.micronaut.inject.java) 23 | testImplementation(libs.managed.hibernate.jcache) 24 | testImplementation(mn.micronaut.management) 25 | testImplementation(mn.micronaut.inject.groovy) 26 | testImplementation(mn.micronaut.function.web) 27 | testImplementation(mnCache.micronaut.cache.core) 28 | testImplementation(mnMicrometer.micronaut.micrometer.core) 29 | testImplementation(libs.managed.hibernate.micrometer) 30 | 31 | testRuntimeOnly projects.micronautJdbcTomcat 32 | testRuntimeOnly(libs.managed.h2) 33 | 34 | testCompileOnly(mnData.micronaut.data.connection.jdbc) 35 | } 36 | -------------------------------------------------------------------------------- /hibernate-jpa/src/main/java/io/micronaut/configuration/hibernate/jpa/HibernateCurrentSessionContextClassProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.micronaut.configuration.hibernate.jpa; 17 | 18 | import org.hibernate.context.spi.CurrentSessionContext; 19 | 20 | /** 21 | * Provides the value for {@link org.hibernate.cfg.AvailableSettings#CURRENT_SESSION_CONTEXT_CLASS}. 22 | * 23 | * @author Denis Stepanov 24 | * @since 3.3.2 25 | */ 26 | public interface HibernateCurrentSessionContextClassProvider { 27 | 28 | /** 29 | * @return the class implementing {@link CurrentSessionContext} 30 | */ 31 | Class get(); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /hibernate-jpa/src/main/java/io/micronaut/configuration/hibernate/jpa/TransactionalSession.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.micronaut.configuration.hibernate.jpa; 17 | 18 | import io.micronaut.context.annotation.EachBean; 19 | import io.micronaut.core.annotation.Internal; 20 | import org.hibernate.Session; 21 | import org.hibernate.SessionFactory; 22 | 23 | /** 24 | * Represents a transaction aware session that can be dependency injected. 25 | * 26 | * @author graemerocher 27 | * @since 2.0 28 | */ 29 | @EachBean(SessionFactory.class) 30 | @TransactionalSessionAdvice 31 | @Internal 32 | public interface TransactionalSession extends Session { 33 | } 34 | -------------------------------------------------------------------------------- /hibernate-jpa/src/main/java/io/micronaut/configuration/hibernate/jpa/TransactionalSessionAdvice.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.micronaut.configuration.hibernate.jpa; 17 | 18 | import io.micronaut.aop.Introduction; 19 | import io.micronaut.core.annotation.Internal; 20 | import java.lang.annotation.Retention; 21 | 22 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 23 | 24 | /** 25 | * An introduction advice annotation used to create a transaction aware session. 26 | * Considered internal and not for explicit usage. 27 | * 28 | * @see TransactionalSessionInterceptor 29 | * @see TransactionalSession 30 | */ 31 | @Retention(RUNTIME) 32 | @Introduction 33 | @Internal 34 | @interface TransactionalSessionAdvice { 35 | } 36 | -------------------------------------------------------------------------------- /hibernate-jpa/src/main/java/io/micronaut/configuration/hibernate/jpa/conf/settings/SettingsSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2022 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.micronaut.configuration.hibernate.jpa.conf.settings; 17 | 18 | import io.micronaut.configuration.hibernate.jpa.JpaConfiguration; 19 | import io.micronaut.core.annotation.Indexed; 20 | import io.micronaut.core.order.Ordered; 21 | 22 | import java.util.Map; 23 | 24 | /** 25 | * Supply additional settings for {@link JpaConfiguration}. 26 | * 27 | * @author Denis Stepanov 28 | * @since 4.5.0 29 | */ 30 | @Indexed(SettingsSupplier.class) 31 | public interface SettingsSupplier extends Ordered { 32 | 33 | /** 34 | * Supply additional settings for {@link JpaConfiguration}. 35 | * 36 | * @param jpaConfiguration The JPA configuration 37 | * @return the additional settings 38 | */ 39 | Map supply(JpaConfiguration jpaConfiguration); 40 | 41 | } 42 | -------------------------------------------------------------------------------- /hibernate-jpa/src/main/java/io/micronaut/configuration/hibernate/jpa/metrics/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Classes related to tracking metrics for Hibernate. 18 | * 19 | * @author graemerocher 20 | * @since 1.0 21 | */ 22 | package io.micronaut.configuration.hibernate.jpa.metrics; 23 | -------------------------------------------------------------------------------- /hibernate-jpa/src/main/java/io/micronaut/configuration/hibernate/jpa/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * This package contains a configuration for Hibernate and JPA. 18 | * 19 | * @author graemerocher 20 | * @since 1.0 21 | */ 22 | @Configuration 23 | @Requires(property = "jpa.enabled", value = StringUtils.TRUE, defaultValue = StringUtils.TRUE) 24 | @Requires(classes = {SessionFactory.class, Entity.class}) 25 | package io.micronaut.configuration.hibernate.jpa; 26 | 27 | import io.micronaut.context.annotation.Configuration; 28 | import io.micronaut.context.annotation.Requires; 29 | import io.micronaut.core.util.StringUtils; 30 | import org.hibernate.SessionFactory; 31 | 32 | import jakarta.persistence.Entity; 33 | -------------------------------------------------------------------------------- /hibernate-jpa/src/main/java/io/micronaut/configuration/hibernate/jpa/proxy/GenerateProxy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.micronaut.configuration.hibernate.jpa.proxy; 17 | 18 | import io.micronaut.aop.Around; 19 | import io.micronaut.aop.Introduction; 20 | import io.micronaut.context.annotation.Type; 21 | import io.micronaut.core.annotation.Experimental; 22 | 23 | import java.lang.annotation.Documented; 24 | import java.lang.annotation.ElementType; 25 | import java.lang.annotation.Retention; 26 | import java.lang.annotation.Target; 27 | 28 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 29 | 30 | /** 31 | * Annotated Entity class will have a compile time Hibernate proxy. 32 | * 33 | * @author Denis Stepanov 34 | * @since 3.3.0 35 | */ 36 | @Around 37 | @Introduction(interfaces = IntroducedHibernateProxy.class) 38 | @Type(IntroducedHibernateProxyAdvice.class) 39 | @Documented 40 | @Retention(RUNTIME) 41 | @Target({ElementType.TYPE}) 42 | @Experimental 43 | public @interface GenerateProxy { 44 | } 45 | -------------------------------------------------------------------------------- /hibernate-jpa/src/main/java/io/micronaut/configuration/hibernate/jpa/proxy/IntroducedHibernateProxy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.micronaut.configuration.hibernate.jpa.proxy; 17 | 18 | import io.micronaut.aop.MethodInterceptor; 19 | import io.micronaut.core.annotation.Internal; 20 | import org.hibernate.proxy.HibernateProxy; 21 | 22 | /** 23 | * Introduced {@link HibernateProxy} interface to register an interceptor. 24 | * 25 | * @author Denis Stepanov 26 | * @since 3.3.0 27 | */ 28 | @Internal 29 | public interface IntroducedHibernateProxy extends HibernateProxy { 30 | 31 | @SuppressWarnings("MethodName") 32 | void $registerInterceptor(MethodInterceptor interceptor); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /hibernate-jpa/src/main/resources/META-INF/native-image/io.micronaut.sql/hibernate-jpa-graal/reflect-config.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "org.hibernate.internal.log.ConnectionInfoLogger_$logger", 4 | "methods": [ 5 | { 6 | "name": "", 7 | "parameterTypes": [ 8 | "org.jboss.logging.Logger" 9 | ] 10 | } 11 | ] 12 | }, 13 | { 14 | "name": "[Lorg.hibernate.event.spi.PostUpsertEventListener;" 15 | }, 16 | { 17 | "name":"[Lorg.hibernate.query.sqm.tree.select.SqmQueryPart;" 18 | } 19 | ] 20 | -------------------------------------------------------------------------------- /hibernate-jpa/src/test/groovy/io/micronaut/configuration/hibernate/jpa/JavaReadOnlyBookService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.micronaut.configuration.hibernate.jpa; 17 | 18 | 19 | import io.micronaut.transaction.annotation.Transactional; 20 | 21 | import jakarta.persistence.EntityManager; 22 | 23 | @jakarta.transaction.Transactional 24 | @Transactional(readOnly = true) 25 | public class JavaReadOnlyBookService { 26 | 27 | private final EntityManager entityManager; 28 | 29 | public JavaReadOnlyBookService(EntityManager entityManager) { 30 | this.entityManager = entityManager; 31 | } 32 | 33 | public boolean testNativeQuery() { 34 | // just testing the method can be invoked 35 | entityManager.createNativeQuery("select * from book", Book.class).getResultList(); 36 | return true; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /hibernate-jpa/src/test/groovy/io/micronaut/configuration/hibernate/jpa/datasources/db2/Bookstore.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.micronaut.configuration.hibernate.jpa.datasources.db2; 17 | 18 | 19 | import jakarta.persistence.*; 20 | import jakarta.validation.constraints.NotNull; 21 | 22 | @Entity 23 | @Table(name = "bookstore") 24 | public class Bookstore { 25 | 26 | public Bookstore() {} 27 | 28 | public Bookstore(@NotNull String name) { 29 | this.name = name; 30 | } 31 | 32 | @Id 33 | @GeneratedValue(strategy = GenerationType.AUTO) 34 | private Long id; 35 | 36 | @NotNull 37 | @Column(name = "name", nullable = false) 38 | private String name; 39 | 40 | public Long getId() { 41 | return id; 42 | } 43 | 44 | public void setId(Long id) { 45 | this.id = id; 46 | } 47 | 48 | public String getName() { 49 | return name; 50 | } 51 | 52 | public void setName(String name) { 53 | this.name = name; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /hibernate-jpa/src/test/groovy/io/micronaut/configuration/hibernate/jpa/jcache/TestCachedEntity.java: -------------------------------------------------------------------------------- 1 | package io.micronaut.configuration.hibernate.jpa.jcache; 2 | 3 | import jakarta.persistence.Entity; 4 | import jakarta.persistence.GeneratedValue; 5 | import jakarta.persistence.Id; 6 | 7 | @Entity 8 | public class TestCachedEntity { 9 | @GeneratedValue 10 | @Id 11 | private Long id; 12 | 13 | public Long getId() { 14 | return id; 15 | } 16 | 17 | public void setId(Long id) { 18 | this.id = id; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /hibernate-jpa/src/test/groovy/io/micronaut/configuration/hibernate/jpa/mapping/CustomIndexesDatabaseObject.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.micronaut.configuration.hibernate.jpa.mapping; 17 | 18 | import org.hibernate.boot.model.relational.AbstractAuxiliaryDatabaseObject; 19 | import org.hibernate.boot.model.relational.SqlStringGenerationContext; 20 | 21 | public class CustomIndexesDatabaseObject extends AbstractAuxiliaryDatabaseObject { 22 | 23 | @Override 24 | public String[] sqlCreateStrings(SqlStringGenerationContext context) { 25 | return new String[]{"CREATE VIEW custom_view AS SELECT * FROM account"}; 26 | } 27 | 28 | @Override 29 | public String[] sqlDropStrings(SqlStringGenerationContext context) { 30 | return new String[]{"DROP VIEW IF EXISTS custom_view"}; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /hibernate-jpa/src/test/groovy/io/micronaut/configuration/hibernate/jpa/other/Author.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.micronaut.configuration.hibernate.jpa.other 17 | 18 | import jakarta.persistence.Entity 19 | import jakarta.persistence.GeneratedValue 20 | import jakarta.persistence.Id 21 | import jakarta.validation.constraints.NotBlank 22 | 23 | @Entity 24 | class Author { 25 | 26 | @Id 27 | @GeneratedValue 28 | Long id 29 | 30 | @NotBlank 31 | String name 32 | } 33 | -------------------------------------------------------------------------------- /hibernate-jpa/src/test/groovy/io/micronaut/configuration/hibernate/jpa/proxy/CustomId.java: -------------------------------------------------------------------------------- 1 | package io.micronaut.configuration.hibernate.jpa.proxy; 2 | 3 | import java.io.Serializable; 4 | 5 | public class CustomId implements Serializable { 6 | 7 | private String a; 8 | private String b; 9 | 10 | public CustomId() { 11 | } 12 | 13 | public CustomId(String a, String b) { 14 | this.a = a; 15 | this.b = b; 16 | } 17 | 18 | public String getA() { 19 | return a; 20 | } 21 | 22 | public void setA(String a) { 23 | this.a = a; 24 | } 25 | 26 | public String getB() { 27 | return b; 28 | } 29 | 30 | public void setB(String b) { 31 | this.b = b; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /hibernate-jpa/src/test/groovy/io/micronaut/configuration/hibernate/jpa/proxy/DepartmentCompositeId.java: -------------------------------------------------------------------------------- 1 | package io.micronaut.configuration.hibernate.jpa.proxy; 2 | 3 | import jakarta.persistence.Entity; 4 | import jakarta.persistence.FetchType; 5 | import jakarta.persistence.Id; 6 | import jakarta.persistence.OneToMany; 7 | import java.io.Serializable; 8 | import java.util.Set; 9 | 10 | @Entity 11 | @GenerateProxy 12 | public class DepartmentCompositeId implements Serializable { 13 | 14 | @Id 15 | private String a; 16 | @Id 17 | private String b; 18 | private String name; 19 | 20 | @OneToMany(fetch = FetchType.LAZY, mappedBy = "departmentCompositeId") 21 | private Set customers; 22 | 23 | public String getA() { 24 | return a; 25 | } 26 | 27 | public void setA(String a) { 28 | this.a = a; 29 | } 30 | 31 | public String getB() { 32 | return b; 33 | } 34 | 35 | public void setB(String b) { 36 | this.b = b; 37 | } 38 | 39 | public String getName() { 40 | return name; 41 | } 42 | 43 | public void setName(String name) { 44 | this.name = name; 45 | } 46 | 47 | public Set getCustomers() { 48 | return customers; 49 | } 50 | 51 | public void setCustomers(Set customers) { 52 | this.customers = customers; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /hibernate-jpa/src/test/groovy/io/micronaut/configuration/hibernate/jpa/proxy/EmbeddedData.java: -------------------------------------------------------------------------------- 1 | package io.micronaut.configuration.hibernate.jpa.proxy; 2 | 3 | import jakarta.persistence.Embeddable; 4 | 5 | @Embeddable 6 | public class EmbeddedData { 7 | 8 | private String f; 9 | 10 | public String getF() { 11 | return f; 12 | } 13 | 14 | public void setF(String f) { 15 | this.f = f; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /hibernate-jpa/src/test/resources/hibernate/custom.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /hibernate-jpa/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /hibernate-reactive/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'io.micronaut.build.internal.sql-module' 3 | } 4 | 5 | dependencies { 6 | annotationProcessor(mn.micronaut.graal) 7 | 8 | api(projects.micronautHibernateJpa) { 9 | exclude module: 'jdbc' 10 | exclude group: 'micronaut-data' 11 | } 12 | api libs.managed.hibernate.reactive.core 13 | api mn.micronaut.runtime 14 | 15 | compileOnly libs.managed.vertx.sql.client 16 | runtimeOnly libs.managed.ongres.scram.client 17 | 18 | testAnnotationProcessor mn.micronaut.inject.java 19 | testImplementation mn.micronaut.inject.java 20 | testImplementation mn.micronaut.inject.groovy 21 | testImplementation projects.micronautJdbc 22 | testRuntimeOnly projects.micronautJdbcTomcat 23 | testRuntimeOnly(libs.managed.h2) 24 | 25 | testImplementation(mnTestResources.testcontainers.jdbc) 26 | testImplementation(mnTestResources.testcontainers.postgres) 27 | testImplementation libs.managed.vertx.pg.client 28 | testImplementation(mnData.micronaut.data.tx.hibernate) 29 | } 30 | -------------------------------------------------------------------------------- /hibernate-reactive/src/test/groovy/io/micronaut/configuration/hibernate/reactive/multiple/other/Author.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.micronaut.configuration.hibernate.reactive.multiple.other 17 | 18 | import jakarta.persistence.Entity 19 | import jakarta.persistence.GeneratedValue 20 | import jakarta.persistence.Id 21 | import jakarta.validation.constraints.NotBlank 22 | 23 | @Entity 24 | class Author { 25 | 26 | @Id 27 | @GeneratedValue 28 | Long id 29 | 30 | @NotBlank 31 | String name 32 | } 33 | -------------------------------------------------------------------------------- /hibernate-reactive/src/test/groovy/io/micronaut/configuration/hibernate/reactive/multiple/xyz/Book.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.micronaut.configuration.hibernate.reactive.multiple.xyz 17 | 18 | import jakarta.persistence.Entity 19 | import jakarta.persistence.GeneratedValue 20 | import jakarta.persistence.Id 21 | import jakarta.validation.constraints.NotBlank 22 | 23 | @Entity 24 | class Book { 25 | 26 | @Id 27 | @GeneratedValue 28 | Long id 29 | 30 | @NotBlank 31 | String name 32 | } 33 | -------------------------------------------------------------------------------- /hibernate-reactive/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /jasync-sql/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'io.micronaut.build.internal.sql-module' 3 | } 4 | 5 | dependencies { 6 | api(mn.micronaut.inject) 7 | 8 | implementation(mn.reactor) 9 | 10 | compileOnly(libs.managed.jasync.mysql) 11 | compileOnly(libs.managed.jasync.postgresql) 12 | compileOnly(mn.micronaut.management) 13 | 14 | testImplementation(mn.micronaut.management) 15 | testImplementation(mnTestResources.testcontainers.postgres) 16 | testImplementation(libs.managed.jasync.postgresql) 17 | testImplementation(mn.micronaut.management) 18 | testImplementation(mn.micronaut.http.client) 19 | testImplementation(mn.micronaut.http.server.netty) 20 | } 21 | -------------------------------------------------------------------------------- /jasync-sql/src/main/java/io/micronaut/configuration/jasync/JasyncClientSettings.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.micronaut.configuration.jasync; 17 | 18 | /** 19 | * Client settings interface. 20 | */ 21 | public interface JasyncClientSettings { 22 | /** 23 | * The prefix to use for all Jasync Client settings. 24 | */ 25 | String PREFIX = "jasync.client"; 26 | } 27 | -------------------------------------------------------------------------------- /jasync-sql/src/main/java/io/micronaut/configuration/jasync/condition/RequiresJasyncClient.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.micronaut.configuration.jasync.condition; 17 | 18 | import io.micronaut.configuration.jasync.JasyncClientSettings; 19 | import io.micronaut.configuration.jasync.JasyncPoolConfiguration; 20 | import io.micronaut.context.annotation.Requires; 21 | 22 | import java.lang.annotation.Documented; 23 | import java.lang.annotation.ElementType; 24 | import java.lang.annotation.Retention; 25 | import java.lang.annotation.RetentionPolicy; 26 | import java.lang.annotation.Target; 27 | 28 | /** 29 | */ 30 | @Documented 31 | @Retention(RetentionPolicy.RUNTIME) 32 | @Target({ElementType.PACKAGE, ElementType.TYPE}) 33 | @Requires(property = JasyncClientSettings.PREFIX) 34 | @Requires(classes = {JasyncPoolConfiguration.class}) 35 | public @interface RequiresJasyncClient { 36 | } 37 | -------------------------------------------------------------------------------- /jasync-sql/src/main/java/io/micronaut/configuration/jasync/condition/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Reactive Postgres Client condition. 18 | * 19 | * @author puneetbehl 20 | * @since 1.0 21 | */ 22 | 23 | package io.micronaut.configuration.jasync.condition; 24 | -------------------------------------------------------------------------------- /jasync-sql/src/main/java/io/micronaut/configuration/jasync/health/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Reactive Pg Client heath indicator. 18 | * 19 | * @author puneetbehl 20 | * @since 1.0 21 | */ 22 | package io.micronaut.configuration.jasync.health; 23 | 24 | -------------------------------------------------------------------------------- /jasync-sql/src/main/java/io/micronaut/configuration/jasync/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Reactive Postgres Client PgPoolConfiguration classes. 18 | * 19 | * @author puneetbehl 20 | * @since 1.0 21 | */ 22 | @Configuration 23 | @RequiresJasyncClient 24 | package io.micronaut.configuration.jasync; 25 | 26 | import io.micronaut.configuration.jasync.condition.RequiresJasyncClient; 27 | import io.micronaut.context.annotation.Configuration; 28 | -------------------------------------------------------------------------------- /jasync-sql/src/test/groovy/io/micronaut/configuration/jasync/ApplicationContextSpecification.groovy: -------------------------------------------------------------------------------- 1 | package io.micronaut.configuration.jasync 2 | 3 | import io.micronaut.context.ApplicationContext 4 | import spock.lang.AutoCleanup 5 | import spock.lang.Shared 6 | import spock.lang.Specification 7 | 8 | class ApplicationContextSpecification extends Specification implements ConfigurationFixture { 9 | 10 | @AutoCleanup 11 | @Shared 12 | ApplicationContext applicationContext = ApplicationContext.run(configuration) 13 | } 14 | -------------------------------------------------------------------------------- /jasync-sql/src/test/groovy/io/micronaut/configuration/jasync/ConfigurationFixture.groovy: -------------------------------------------------------------------------------- 1 | package io.micronaut.configuration.jasync 2 | 3 | trait ConfigurationFixture { 4 | 5 | Map getConfiguration() { 6 | Map m = [:] 7 | if (specName) { 8 | m['spec.name'] = specName 9 | } 10 | m 11 | } 12 | 13 | String getSpecName() { 14 | null 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /jasync-sql/src/test/groovy/io/micronaut/configuration/jasync/JasyncQueryInterceptorsSpec.groovy: -------------------------------------------------------------------------------- 1 | package io.micronaut.configuration.jasync 2 | 3 | import com.github.jasync.sql.db.interceptor.LoggingInterceptorSupplier 4 | import com.github.jasync.sql.db.interceptor.MdcQueryInterceptorSupplier 5 | import com.github.jasync.sql.db.interceptor.QueryInterceptor 6 | 7 | class JasyncQueryInterceptorsSpec extends ApplicationContextSpecification { 8 | 9 | @Override 10 | Map getConfiguration() { 11 | super.configuration + ['jasync.client.port': '5433'] 12 | } 13 | 14 | void "test jasync-client interceptors configuration"() { 15 | given: 16 | List queryInterceptors = [ 17 | new MdcQueryInterceptorSupplier().get(), 18 | new LoggingInterceptorSupplier().get() 19 | ] 20 | 21 | when: 22 | queryInterceptors.each { queryInterceptor -> 23 | applicationContext.registerSingleton(queryInterceptor) 24 | } 25 | 26 | then: 27 | applicationContext.containsBean(JasyncPoolConfiguration) 28 | applicationContext.containsBean(QueryInterceptor) 29 | applicationContext.getBeansOfType(QueryInterceptor).size() == queryInterceptors.size() 30 | 31 | and: 32 | def config = applicationContext.getBean(JasyncPoolConfiguration) 33 | config.jasyncOptions 34 | config.jasyncOptions.interceptors 35 | config.jasyncOptions.interceptors.size() == queryInterceptors.size() 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /jasync-sql/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /jdbc-dbcp/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'io.micronaut.build.internal.sql-module' 3 | } 4 | 5 | dependencies { 6 | api projects.micronautJdbc 7 | api(mn.micronaut.inject) 8 | api(libs.managed.commons.dbcp2) 9 | 10 | testRuntimeOnly(libs.managed.tomcat.jdbc) 11 | testRuntimeOnly(libs.managed.h2) 12 | 13 | testAnnotationProcessor(mn.micronaut.inject.java) 14 | testImplementation(mn.micronaut.http.server.netty) 15 | testImplementation(mn.micronaut.http.client) 16 | testImplementation(mn.micronaut.management) 17 | testImplementation(mnMicrometer.micronaut.micrometer.core) 18 | testImplementation(mnCache.micronaut.cache.core) 19 | } 20 | -------------------------------------------------------------------------------- /jdbc-dbcp/src/main/java/io/micronaut/configuration/jdbc/dbcp/metadata/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Contains classes for reading JDBC metadata for DBCP. 18 | * 19 | * @author graemerocher 20 | * @since 1.0 21 | */ 22 | package io.micronaut.configuration.jdbc.dbcp.metadata; 23 | -------------------------------------------------------------------------------- /jdbc-dbcp/src/main/java/io/micronaut/configuration/jdbc/dbcp/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2024 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Configuration for Apache DBCP data sources. 18 | */ 19 | @Configuration 20 | @Requires(classes = BasicDataSource.class) 21 | package io.micronaut.configuration.jdbc.dbcp; 22 | 23 | import io.micronaut.context.annotation.Configuration; 24 | import io.micronaut.context.annotation.Requires; 25 | import org.apache.commons.dbcp2.BasicDataSource; 26 | -------------------------------------------------------------------------------- /jdbc-dbcp/src/main/resources/META-INF/native-image/io.micronaut.sql/jdbc-dbcp-graal/resource-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "bundles": [ 3 | {"name": "org.apache.commons.dbcp2.LocalStrings"} 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /jdbc-dbcp/src/test/groovy/io/micronaut/configuration/jdbc/dbcp/metadata/AbstractDataSourcePoolMetadataSpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.micronaut.configuration.jdbc.dbcp.metadata 17 | 18 | import spock.lang.Shared 19 | import spock.lang.Specification 20 | 21 | class AbstractDataSourcePoolMetadataSpec extends Specification { 22 | 23 | @Shared 24 | def metricNames = [ 25 | 'jdbc.connections.usage', 26 | 'jdbc.connections.active', 27 | 'jdbc.connections.max', 28 | 'jdbc.connections.min' 29 | ] 30 | 31 | } 32 | -------------------------------------------------------------------------------- /jdbc-dbcp/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /jdbc-hikari/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'io.micronaut.build.internal.sql-module' 3 | } 4 | 5 | dependencies { 6 | api projects.micronautJdbc 7 | api(mn.micronaut.inject) 8 | api(libs.managed.hikaricp) 9 | 10 | compileOnly(mnMicrometer.micronaut.micrometer.core) 11 | 12 | testRuntimeOnly(libs.managed.tomcat.jdbc) 13 | testRuntimeOnly(libs.managed.h2) 14 | 15 | testAnnotationProcessor(mn.micronaut.inject.java) 16 | testImplementation(mn.micronaut.http.server.netty) 17 | testImplementation(mn.micronaut.http.client) 18 | testImplementation(mn.micronaut.management) 19 | 20 | testImplementation(mnMicrometer.micronaut.micrometer.core) 21 | testImplementation(mnCache.micronaut.cache.core) 22 | } 23 | -------------------------------------------------------------------------------- /jdbc-hikari/src/main/java/io/micronaut/configuration/jdbc/hikari/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2024 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Configuration for Hikari data sources. 18 | */ 19 | @Configuration 20 | @Requires(classes = HikariDataSource.class) 21 | package io.micronaut.configuration.jdbc.hikari; 22 | 23 | import com.zaxxer.hikari.HikariDataSource; 24 | import io.micronaut.context.annotation.Configuration; 25 | import io.micronaut.context.annotation.Requires; 26 | -------------------------------------------------------------------------------- /jdbc-hikari/src/test/groovy/io/micronaut/configuration/jdbc/hikari/DatasourceFactorySpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.micronaut.configuration.jdbc.hikari 17 | 18 | import io.micronaut.context.ApplicationContext 19 | import spock.lang.Specification 20 | 21 | class DatasourceFactorySpec extends Specification { 22 | 23 | def "wire class with constructor"() { 24 | expect: 25 | new DatasourceFactory(Mock(ApplicationContext)) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /jdbc-hikari/src/test/groovy/io/micronaut/configuration/jdbc/hikari/metadata/AbstractDataSourcePoolMetadataSpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.micronaut.configuration.jdbc.hikari.metadata 17 | 18 | import spock.lang.Shared 19 | import spock.lang.Specification 20 | 21 | class AbstractDataSourcePoolMetadataSpec extends Specification { 22 | 23 | @Shared 24 | def metricNames = [ 25 | 'hikaricp.connections.idle', 26 | 'hikaricp.connections.pending', 27 | 'hikaricp.connections', 28 | 'hikaricp.connections.active', 29 | 'hikaricp.connections.creation' , 30 | 'hikaricp.connections.max', 31 | 'hikaricp.connections.min', 32 | 'hikaricp.connections.usage', 33 | 'hikaricp.connections.timeout', 34 | 'hikaricp.connections.acquire' 35 | ] 36 | 37 | } 38 | -------------------------------------------------------------------------------- /jdbc-hikari/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /jdbc-tomcat/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'io.micronaut.build.internal.sql-module' 3 | } 4 | 5 | dependencies { 6 | api projects.micronautJdbc 7 | api(mn.micronaut.inject) 8 | api(libs.managed.tomcat.jdbc) 9 | 10 | testRuntimeOnly(libs.managed.h2) 11 | 12 | testAnnotationProcessor(mn.micronaut.inject.java) 13 | testImplementation(mn.micronaut.http.server.netty) 14 | testImplementation(mn.micronaut.http.client) 15 | testImplementation(mn.micronaut.management) 16 | 17 | testImplementation(mnMicrometer.micronaut.micrometer.core) 18 | testImplementation(mnCache.micronaut.cache.core) 19 | } 20 | -------------------------------------------------------------------------------- /jdbc-tomcat/src/main/java/io/micronaut/configuration/jdbc/tomcat/metadata/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Contains classes for reading JDBC metadata for Tomcat. 18 | * 19 | * @author graemerocher 20 | * @since 1.0 21 | */ 22 | package io.micronaut.configuration.jdbc.tomcat.metadata; 23 | -------------------------------------------------------------------------------- /jdbc-tomcat/src/main/java/io/micronaut/configuration/jdbc/tomcat/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2024 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Configuration for Tomcat JDBC data sources. 18 | */ 19 | @Configuration 20 | @Requires(classes = DataSource.class) 21 | package io.micronaut.configuration.jdbc.tomcat; 22 | 23 | import io.micronaut.context.annotation.Configuration; 24 | import io.micronaut.context.annotation.Requires; 25 | import org.apache.tomcat.jdbc.pool.DataSource; 26 | -------------------------------------------------------------------------------- /jdbc-tomcat/src/main/resources/META-INF/native-image/io.micronaut.sql/jdbc-tomcat-graal/proxy-config.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "interfaces": [ 4 | "java.sql.ResultSet" 5 | ] 6 | } 7 | ] 8 | -------------------------------------------------------------------------------- /jdbc-tomcat/src/test/groovy/io/micronaut/configuration/jdbc/tomcat/metadata/AbstractDataSourcePoolMetadataSpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.micronaut.configuration.jdbc.tomcat.metadata 17 | 18 | import spock.lang.Shared 19 | import spock.lang.Specification 20 | 21 | class AbstractDataSourcePoolMetadataSpec extends Specification { 22 | 23 | @Shared 24 | def metricNames = [ 25 | 'jdbc.connections.usage', 26 | 'jdbc.connections.active', 27 | 'jdbc.connections.max', 28 | 'jdbc.connections.min' 29 | ] 30 | 31 | } 32 | -------------------------------------------------------------------------------- /jdbc-tomcat/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /jdbc-ucp/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'io.micronaut.build.internal.sql-module' 3 | } 4 | 5 | dependencies { 6 | api projects.micronautJdbc 7 | api(mn.micronaut.inject) 8 | api(mn.micronaut.context) 9 | api(libs.managed.ucp11) 10 | api(libs.managed.ojdbc11) 11 | 12 | testRuntimeOnly(libs.managed.h2) 13 | 14 | testAnnotationProcessor(mn.micronaut.inject.java) 15 | testImplementation(mn.micronaut.http.server.netty) 16 | testImplementation(mn.micronaut.http.client) 17 | testImplementation(mn.micronaut.management) 18 | testImplementation(mnMicrometer.micronaut.micrometer.core) 19 | testImplementation(mnCache.micronaut.cache.core) 20 | 21 | testImplementation(mnSpring.spring.jdbc) 22 | testImplementation(libs.ojdbc11dms) 23 | testImplementation(libs.dms) 24 | } 25 | -------------------------------------------------------------------------------- /jdbc-ucp/src/main/java/io/micronaut/configuration/jdbc/ucp/OracleUcpConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2025 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.micronaut.configuration.jdbc.ucp; 17 | 18 | import io.micronaut.context.annotation.ConfigurationProperties; 19 | import io.micronaut.context.annotation.Requires; 20 | import io.micronaut.core.annotation.Nullable; 21 | 22 | import static io.micronaut.configuration.jdbc.ucp.OracleUcpConfiguration.PREFIX; 23 | 24 | /** 25 | * Configuration properties for Oracle Universal Connection Pooling (UCP). 26 | * 27 | * @param destroyOnReload Flag indicating whether to destroy connections on reload 28 | */ 29 | @ConfigurationProperties(PREFIX) 30 | @Requires(property = PREFIX) 31 | public record OracleUcpConfiguration(@Nullable Boolean destroyOnReload) { 32 | 33 | /** Prefix used for configuration properties. */ 34 | static final String PREFIX = "oracle.ucp"; 35 | } 36 | -------------------------------------------------------------------------------- /jdbc-ucp/src/main/java/io/micronaut/configuration/jdbc/ucp/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2024 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Configuration for Tomcat JDBC data sources. 18 | */ 19 | @Configuration 20 | @Requires(classes = PoolDataSource.class) 21 | package io.micronaut.configuration.jdbc.ucp; 22 | 23 | import io.micronaut.context.annotation.Configuration; 24 | import io.micronaut.context.annotation.Requires; 25 | import oracle.ucp.jdbc.PoolDataSource; 26 | -------------------------------------------------------------------------------- /jdbc-ucp/src/test/groovy/io/micronaut/configuration/jdbc/ucp/UniversalConnectionPoolManagerFactorySpec.groovy: -------------------------------------------------------------------------------- 1 | package io.micronaut.configuration.jdbc.ucp 2 | 3 | import io.micronaut.context.ApplicationContext 4 | import oracle.ucp.admin.UniversalConnectionPoolManager 5 | import spock.lang.Specification 6 | import spock.lang.Unroll 7 | 8 | class UniversalConnectionPoolManagerFactorySpec extends Specification { 9 | 10 | void "the pool is not available when disabled is enabled"() { 11 | given: 12 | ApplicationContext applicationContext = ApplicationContext.run( 13 | [ 14 | "ucp-manager.enabled": false, 15 | ], 16 | "test") 17 | 18 | expect: 19 | !applicationContext.containsBean(UniversalConnectionPoolManager) 20 | !applicationContext.containsBean(ConnectionPoolManagerListener) 21 | 22 | cleanup: 23 | applicationContext.close() 24 | } 25 | 26 | @Unroll 27 | void "the mxbean is enabled: #enabled"() { 28 | given: 29 | ApplicationContext applicationContext = ApplicationContext.run( 30 | [ 31 | "ucp-manager.enabled" : true, 32 | "ucp-manager.jmx.enabled": enabled], 33 | "test") 34 | 35 | 36 | expect: 37 | applicationContext.getBean(UniversalConnectionPoolManager).isJmxEnabled() == enabled 38 | 39 | cleanup: 40 | applicationContext.close() 41 | 42 | where: 43 | enabled << [true, false] 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /jdbc-ucp/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /jdbc/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'io.micronaut.build.internal.sql-module' 3 | } 4 | 5 | dependencies { 6 | annotationProcessor(mn.micronaut.graal) 7 | 8 | api(mn.micronaut.inject) 9 | } 10 | -------------------------------------------------------------------------------- /jdbc/src/main/java/io/micronaut/jdbc/DataSourceResolver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.micronaut.jdbc; 17 | 18 | import javax.sql.DataSource; 19 | 20 | /** 21 | * Resolves the underlying target data source. 22 | * 23 | * @author graemerocher 24 | * @since 1.0 25 | */ 26 | public interface DataSourceResolver { 27 | /** 28 | * The default implementation. 29 | */ 30 | DataSourceResolver DEFAULT = new DataSourceResolver() { 31 | }; 32 | 33 | /** 34 | * Resolves the underlying target data source in the case it has been wrapped by proxying / instrumentation logic. 35 | * 36 | * @param dataSource The data source 37 | * @return The unwrapped datasource 38 | */ 39 | default DataSource resolve(DataSource dataSource) { 40 | return dataSource; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /jdbc/src/main/java/io/micronaut/jdbc/metadata/DataSourcePoolMetadataProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.micronaut.jdbc.metadata; 17 | 18 | /** 19 | * Provide a {@link DataSourcePoolMetadata} based on a {@link javax.sql.DataSource}. 20 | * 21 | * @author Stephane Nicoll 22 | * @author Christian Oestreich 23 | * @since 2.0.0 24 | */ 25 | @FunctionalInterface 26 | public interface DataSourcePoolMetadataProvider { 27 | 28 | /** 29 | * Return the {@link DataSourcePoolMetadata} instance able to manage the specified 30 | * {@link javax.sql.DataSource} or {@code null} if the given data source could not be handled. 31 | * 32 | * @return the data source pool metadata 33 | */ 34 | DataSourcePoolMetadata getDataSourcePoolMetadata(); 35 | } 36 | -------------------------------------------------------------------------------- /jdbc/src/main/java/io/micronaut/jdbc/metadata/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Support classes for reading JDBC metadata. 18 | * 19 | * @author graemerocher 20 | * @since 1.0 21 | */ 22 | package io.micronaut.jdbc.metadata; 23 | -------------------------------------------------------------------------------- /jdbc/src/main/java/io/micronaut/jdbc/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * JDBC configuration for Micronaut. 18 | * 19 | * @author Sergio del Amo 20 | * @since 1.0 21 | */ 22 | package io.micronaut.jdbc; 23 | 24 | -------------------------------------------------------------------------------- /jdbc/src/main/resources/META-INF/native-image/io.micronaut.sql/micronaut-jdbc/native-image.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017-2020 original authors 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | Args = --add-modules=java.sql.rowset 18 | -------------------------------------------------------------------------------- /jdbc/src/main/resources/META-INF/native-image/io.micronaut.sql/micronaut-jdbc/reflect-config.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "condition": { 4 | "typeReachable": "org.mariadb.jdbc.Configuration" 5 | }, 6 | "name":"org.mariadb.jdbc.Configuration$Builder", 7 | "allDeclaredFields":true, 8 | "methods":[{"name":"password","parameterTypes":["java.lang.String"] }, {"name":"user","parameterTypes":["java.lang.String"] }] 9 | } 10 | ] 11 | -------------------------------------------------------------------------------- /jdbc/src/test/resources/h2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/micronaut-projects/micronaut-sql/4bef137057148827b121cbefee306be3dfbdaa1f/jdbc/src/test/resources/h2.jar -------------------------------------------------------------------------------- /jdbc/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /jdbc/src/test/resources/mysql.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/micronaut-projects/micronaut-sql/4bef137057148827b121cbefee306be3dfbdaa1f/jdbc/src/test/resources/mysql.jar -------------------------------------------------------------------------------- /jdbi/src/main/java/io/micronaut/configuration/jdbi/JdbiCustomizer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.micronaut.configuration.jdbi; 17 | 18 | import org.jdbi.v3.core.Jdbi; 19 | 20 | /** 21 | * Allows custom actions to be performed on a jdbi instance. 22 | * Customizers must be annotated with a {@link jakarta.inject.Named} annotation that matches the datasource name 23 | * corresponding to the jdbi datasource to be customized. 24 | * 25 | * @author Dan Maas 26 | * @since 1.4.0 27 | */ 28 | public interface JdbiCustomizer { 29 | 30 | /** 31 | * Performs custom configuration operations on the given Jdbi instance. 32 | * See https://jdbi.org/apidocs/index.html?org/jdbi/v3/core/config/Configurable.html for available options 33 | * 34 | * @param jdbi the Jdbi instance 35 | */ 36 | void customize(Jdbi jdbi); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /jdbi/src/main/java/io/micronaut/configuration/jdbi/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Configuration for jdbi integration. 18 | * 19 | * @author Dan Maas 20 | * @since 1.4.0 21 | */ 22 | @Configuration 23 | @Requires(classes = Jdbi.class) 24 | package io.micronaut.configuration.jdbi; 25 | 26 | import io.micronaut.context.annotation.Configuration; 27 | import io.micronaut.context.annotation.Requires; 28 | import org.jdbi.v3.core.Jdbi; 29 | -------------------------------------------------------------------------------- /jdbi/src/main/java/io/micronaut/configuration/jdbi/transaction/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Classes specific to combining Jdbi with transaction management. 18 | * 19 | * @author Dan Maas 20 | * @since 1.4.0 21 | */ 22 | package io.micronaut.configuration.jdbi.transaction; 23 | -------------------------------------------------------------------------------- /jdbi/src/main/java/io/micronaut/configuration/jdbi/transaction/spring/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Classes specific to combining Jdbi with Spring Jdbc. 18 | * 19 | * @author Dan Maas 20 | * @since 1.4.0 21 | */ 22 | package io.micronaut.configuration.jdbi.transaction.spring; 23 | -------------------------------------------------------------------------------- /jdbi/src/test/groovy/io/micronaut/configuration/jdbi/TestInterface.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.micronaut.configuration.jdbi; 17 | 18 | import org.jdbi.v3.sqlobject.statement.SqlQuery; 19 | import org.jdbi.v3.sqlobject.transaction.Transaction; 20 | 21 | public interface TestInterface { 22 | @SqlQuery("SELECT COUNT(*) FROM foo") 23 | @Transaction 24 | Integer count(); 25 | } 26 | -------------------------------------------------------------------------------- /jdbi/src/test/groovy/io/micronaut/configuration/jdbi/TestJdbiCustomizer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.micronaut.configuration.jdbi; 17 | 18 | import jakarta.inject.Named; 19 | import jakarta.inject.Singleton; 20 | import org.jdbi.v3.core.Jdbi; 21 | 22 | 23 | @Singleton 24 | @Named("default") 25 | public class TestJdbiCustomizer implements JdbiCustomizer { 26 | @Override 27 | public void customize(Jdbi jdbi) { 28 | jdbi.define("test", "test"); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /jdbi/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /jdbi/src/txTest/groovy/io/micronaut/configuration/jdbi/example/DatabaseSetup.java: -------------------------------------------------------------------------------- 1 | package io.micronaut.configuration.jdbi.example; 2 | 3 | import io.micronaut.configuration.jdbi.example.dao.BooksDao; 4 | import io.micronaut.configuration.jdbi.example.model.Book; 5 | import io.micronaut.data.connection.annotation.Connectable; 6 | import jakarta.inject.Inject; 7 | import jakarta.inject.Named; 8 | import jakarta.inject.Singleton; 9 | import org.jdbi.v3.core.Handle; 10 | import org.jdbi.v3.core.Jdbi; 11 | 12 | @Singleton 13 | public class DatabaseSetup { 14 | private final BooksDao booksDao; 15 | private final Jdbi jdbi; 16 | 17 | @Inject 18 | public DatabaseSetup(@Named("nonTransactional") BooksDao booksDao, Jdbi jdbi) { 19 | this.booksDao = booksDao; 20 | this.jdbi = jdbi; 21 | } 22 | 23 | @Connectable 24 | public void initialize() { 25 | try (Handle open = jdbi.open()) { 26 | open.execute("create table books (id int primary key, name text)"); 27 | } 28 | } 29 | 30 | @Connectable 31 | public void drop() { 32 | try (Handle open = jdbi.open()) { 33 | open.execute("drop table books"); 34 | } 35 | } 36 | 37 | public void fillInitialRecords() { 38 | Book b1 = new Book(1, "A"); 39 | Book b2 = new Book(2, "B"); 40 | Book b3 = new Book(3, "C"); 41 | 42 | booksDao.create(b1); 43 | booksDao.create(b2); 44 | booksDao.create(b3); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /jdbi/src/txTest/groovy/io/micronaut/configuration/jdbi/example/dao/BooksDao.java: -------------------------------------------------------------------------------- 1 | package io.micronaut.configuration.jdbi.example.dao; 2 | 3 | import io.micronaut.configuration.jdbi.example.model.Book; 4 | import io.micronaut.transaction.TransactionOperations; 5 | import io.micronaut.transaction.TransactionStatus; 6 | import org.jdbi.v3.core.transaction.TransactionIsolationLevel; 7 | import org.jdbi.v3.sqlobject.customizer.BindBean; 8 | import org.jdbi.v3.sqlobject.statement.SqlQuery; 9 | import org.jdbi.v3.sqlobject.statement.SqlUpdate; 10 | import org.jdbi.v3.sqlobject.statement.UseRowMapper; 11 | import org.jdbi.v3.sqlobject.transaction.Transaction; 12 | 13 | import java.util.List; 14 | 15 | public interface BooksDao { 16 | 17 | @SqlQuery("SELECT * FROM Books") 18 | @UseRowMapper(BookMapper.class) 19 | @Transaction(TransactionIsolationLevel.READ_COMMITTED) 20 | List listAll(); 21 | 22 | @SqlQuery("SELECT * FROM Books") 23 | @UseRowMapper(BookMapper.class) 24 | List listNoTransaction(); 25 | 26 | @SqlUpdate(""" 27 | INSERT INTO Books (ID, NAME) VALUES (:id, :name) 28 | """) 29 | public void create(@BindBean Book book); 30 | 31 | @Transaction 32 | default Object captureMapperTransaction(TransactionOperations ops) { 33 | BookMapper.transactionOperations = ops; 34 | TransactionStatus status = ops.findTransactionStatus().orElse(null); 35 | if (status == null) { 36 | throw new IllegalStateException("Missing transaction status"); 37 | } 38 | listAll(); 39 | return ops.findTransactionStatus().get(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /jdbi/src/txTest/groovy/io/micronaut/configuration/jdbi/example/dao/DaoFactory.java: -------------------------------------------------------------------------------- 1 | package io.micronaut.configuration.jdbi.example.dao; 2 | 3 | import io.micronaut.context.annotation.Factory; 4 | import io.micronaut.data.connection.annotation.Connectable; 5 | import jakarta.inject.Named; 6 | import jakarta.inject.Singleton; 7 | import jakarta.transaction.Transactional; 8 | import org.jdbi.v3.core.Jdbi; 9 | 10 | @Factory 11 | public class DaoFactory { 12 | @Singleton 13 | @Connectable 14 | @Named("nonTransactional") 15 | BooksDao createBookDao(Jdbi jdbi) { 16 | return jdbi.onDemand(BooksDao.class); 17 | } 18 | 19 | @Singleton 20 | @Connectable 21 | @Named("transactions") 22 | @Transactional 23 | BooksDao createTxBookDao(Jdbi jdbi) { 24 | return jdbi.onDemand(BooksDao.class); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /jdbi/src/txTest/groovy/io/micronaut/configuration/jdbi/example/model/Book.java: -------------------------------------------------------------------------------- 1 | package io.micronaut.configuration.jdbi.example.model; 2 | 3 | public class Book { 4 | private final int id; 5 | private final String name; 6 | 7 | public Book(int id, String name) { 8 | this.id = id; 9 | this.name = name; 10 | } 11 | 12 | public int getId() { 13 | return id; 14 | } 15 | 16 | public String getName() { 17 | return name; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /jooq/src/main/java/io/micronaut/configuration/jooq/DSLContextFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2022 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.micronaut.configuration.jooq; 17 | 18 | import io.micronaut.context.annotation.EachBean; 19 | import io.micronaut.context.annotation.Factory; 20 | import io.micronaut.core.annotation.Internal; 21 | import org.jooq.Configuration; 22 | import org.jooq.DSLContext; 23 | import org.jooq.impl.DefaultDSLContext; 24 | 25 | /** 26 | * Builds {@link DSLContext}. 27 | * 28 | * @author Denis Stepanov 29 | * @since 4.5.0 30 | */ 31 | @Factory 32 | @Internal 33 | final class DSLContextFactory { 34 | 35 | /** 36 | * Created {@link DSLContext} based on {@link Configuration}. 37 | * 38 | * @param configuration The {@link Configuration} 39 | * @return A {@link DSLContext} 40 | */ 41 | @EachBean(Configuration.class) 42 | DSLContext dslContext(Configuration configuration) { 43 | return new DefaultDSLContext(configuration); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /jooq/src/main/java/io/micronaut/configuration/jooq/JooqConfigurationProperties.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.micronaut.configuration.jooq; 17 | 18 | import io.micronaut.context.annotation.EachProperty; 19 | 20 | /** 21 | * Configuration for jOOQ. 22 | * 23 | * @author Vladimir Kulev 24 | * @since 1.2.0 25 | */ 26 | @EachProperty(value = "jooq.datasources") 27 | public final class JooqConfigurationProperties extends AbstractJooqConfigurationProperties { 28 | } 29 | -------------------------------------------------------------------------------- /jooq/src/main/java/io/micronaut/configuration/jooq/R2dbcJooqConfigurationProperties.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2022 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.micronaut.configuration.jooq; 17 | 18 | import io.micronaut.context.annotation.EachProperty; 19 | import io.micronaut.context.annotation.Requires; 20 | import io.r2dbc.spi.ConnectionFactory; 21 | 22 | /** 23 | * R2DBC configuration for jOOQ. 24 | * 25 | * @author Denis Stepanov 26 | * @since 4.5.0 27 | */ 28 | @Requires(classes = ConnectionFactory.class) 29 | @EachProperty(value = "jooq.r2dbc-datasources") 30 | public final class R2dbcJooqConfigurationProperties extends AbstractJooqConfigurationProperties { 31 | } 32 | -------------------------------------------------------------------------------- /jooq/src/main/java/io/micronaut/configuration/jooq/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Configuration for jOOQ integration. 18 | * 19 | * @author Vladimir Kulev 20 | * @since 1.2.0 21 | */ 22 | @Configuration 23 | @Requires(classes = DSLContext.class) 24 | package io.micronaut.configuration.jooq; 25 | 26 | import io.micronaut.context.annotation.Configuration; 27 | import io.micronaut.context.annotation.Requires; 28 | import org.jooq.DSLContext; 29 | -------------------------------------------------------------------------------- /jooq/src/main/java/io/micronaut/configuration/jooq/spring/JooqExceptionTranslatorProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.micronaut.configuration.jooq.spring; 17 | 18 | import io.micronaut.context.annotation.EachBean; 19 | import io.micronaut.context.annotation.Requires; 20 | import org.jooq.ExecuteListener; 21 | import org.jooq.ExecuteListenerProvider; 22 | import org.springframework.jdbc.support.SQLExceptionTranslator; 23 | 24 | import javax.sql.DataSource; 25 | 26 | /** 27 | * Allows {@link SQLExceptionTranslator} to be used with JOOQ. 28 | * 29 | * @author Vladimir Kulev 30 | * @since 1.2.0 31 | */ 32 | @Requires(classes = SQLExceptionTranslator.class) 33 | @EachBean(DataSource.class) 34 | public class JooqExceptionTranslatorProvider implements ExecuteListenerProvider { 35 | 36 | private final JooqExceptionTranslator translator = new JooqExceptionTranslator(); 37 | 38 | @Override 39 | public ExecuteListener provide() { 40 | return translator; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /jooq/src/main/java/io/micronaut/configuration/jooq/spring/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Classes specific to combining JOOQ with Spring JdbcTemplate. 18 | * 19 | * @author Vladimir Kulev 20 | * @since 1.2.0 21 | */ 22 | package io.micronaut.configuration.jooq.spring; 23 | -------------------------------------------------------------------------------- /jooq/src/main/resources/META-INF/native-image/io.micronaut.sql/jooq-graal/native-image.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017-2021 original authors 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | Args = -H:ClassInitialization=org.jooq.SQLDialect$ThirdParty:build_time \ 18 | --initialize-at-run-time=io.micronaut.configuration.jooq.spring.SpringTransactionProvider,io.micronaut.configuration.jooq.spring.JooqExceptionTranslator \ 19 | --initialize-at-build-time=org.simpleflatmapper.reflect.DefaultReflectionService 20 | -------------------------------------------------------------------------------- /jooq/src/test/groovy/io/micronaut/configuration/jooq/CustomConverterProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.micronaut.configuration.jooq; 17 | 18 | import io.micronaut.core.annotation.Nullable; 19 | import org.jooq.Converter; 20 | import org.jooq.ConverterProvider; 21 | import org.jooq.impl.DefaultConverterProvider; 22 | 23 | public class CustomConverterProvider implements ConverterProvider { 24 | 25 | private final DefaultConverterProvider delegate = new DefaultConverterProvider(); 26 | 27 | @Override 28 | public @Nullable 29 | Converter provide(Class tType, Class uType) { 30 | return delegate.provide(tType, uType); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /jooq/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /jooq/src/txTest/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /sql-bom/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'io.micronaut.build.internal.bom' 3 | } 4 | 5 | micronautBom { 6 | excludeProject.set({ p -> 7 | p.path.startsWith(':test') 8 | } as Spec) 9 | } 10 | 11 | micronautBom { 12 | suppressions { 13 | acceptedLibraryRegressions.add("micronaut-hibernate-jpa-spring") 14 | acceptedVersionRegressions.add("commons-dbcp-compat") 15 | acceptedLibraryRegressions.add("commons-dbcp") 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/docs/guide/breaks.adoc: -------------------------------------------------------------------------------- 1 | == Micronaut SQL 5.8.0 2 | 3 | In Micronaut SQL 5.7.0, you could <> if you set `datasources.enabled` to `false`. Since Micronaut SQL 5.8.0, it is no longer supported. If you have multiple data sources, you have to disable them all individually. For example if you had two data sources named `a` and `b`, you have to set `datasources.a.enabled=false` and `datasources.b.enabled=false`. -------------------------------------------------------------------------------- /src/main/docs/guide/hibernate/hibernate-customizing.adoc: -------------------------------------------------------------------------------- 1 | There are several different ways you can customize and configure how the `SessionFactory` is built. The easiest way is via configuration. The following configuration demonstrates an example: 2 | 3 | [configuration] 4 | .Configuring Hibernate Properties 5 | ---- 6 | datasources: 7 | default: 8 | name: 'mydb' 9 | jpa: 10 | default: 11 | entity-scan: 12 | packages: 13 | - 'foo.bar' 14 | - 'foo.baz' 15 | properties: 16 | hibernate: 17 | hbm2ddl: 18 | auto: update 19 | show_sql: true 20 | ---- 21 | 22 | The above example configures the packages to be scanned and sets properties to be passed to Hibernate. As you can see these are done on a per `DataSource` basis. Refer to the api:configuration.hibernate.jpa.JpaConfiguration[] configuration class for the possible options. 23 | 24 | If you need even further control over how the `SessionFactory` is built then you can register api:context.event.BeanCreatedEventListener[] beans that listen for the creation of the link:{hibernateapi}/org/hibernate/boot/SessionFactoryBuilder.html[SessionFactoryBuilder], link:{hibernateapi}/org/hibernate/boot/MetadataSources.html[MetadataSources] etc. and apply your custom configuration in the listener. 25 | 26 | You may also optionally create beans of type link:{hibernateapi}/org/hibernate/integrator/spi/Integrator.html[Integrator] and link:{hibernateapi}/org/hibernate/Interceptor.html[Interceptor] and these will be picked up and injected automatically. 27 | -------------------------------------------------------------------------------- /src/main/docs/guide/hibernate/hibernate-disable.adoc: -------------------------------------------------------------------------------- 1 | You can disable Micronaut Hibernate JPA, for example in a test, by setting `jpa.enabled` to `false`. 2 | -------------------------------------------------------------------------------- /src/main/docs/guide/hibernate/hibernate-inject-session.adoc: -------------------------------------------------------------------------------- 1 | You can use the `javax.persistence.PersistenceContext` annotation to inject an `EntityManager` (or Hibernate `Session`). To do so you need to make sure the JPA annotations are on the `annotationProcessor` path in your build: 2 | 3 | [source,groovy] 4 | .Adding the JPA dependency to `annotationProcessor` in Gradle 5 | ---- 6 | annotationProcessor "jakarta.persistence:jakarta.persistence-api:2.2" 7 | ---- 8 | 9 | [source,java] 10 | .Using `@PersistenceContext` 11 | ---- 12 | @PersistenceContext 13 | EntityManager entityManager; 14 | 15 | @PersistenceContext(name = "other") 16 | EntityManager otherManager; 17 | ---- 18 | 19 | Micronaut will inject a compile time scoped proxy that retrieves the `EntityManager` associated with the current transaction when using https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/transaction/annotation/Transactional.html[@Transactional] (see "Using Spring Transaction Management" below). 20 | 21 | Note the examples above use field injection, since the `@PersistenceContext` annotation does not support declaration on a parameter of a constructor or method argument. Therefore if you wish to instead use constructor or method injection you must use the ann:configuration.hibernate.jpa.scope.CurrentSession[] instead: 22 | 23 | [source,java] 24 | .Using `@CurrentSession` for constructor injection 25 | ---- 26 | public MyService(@CurrentSession EntityManager entityManager) { 27 | this.entityManager = entityManager; 28 | } 29 | ---- 30 | -------------------------------------------------------------------------------- /src/main/docs/guide/hibernate/hibernate-lazy-initialization.adoc: -------------------------------------------------------------------------------- 1 | Micronaut is built on Netty which is based on a non-blocking, event loop model. JDBC and Hibernate are blocking APIs and hence when they are used in a Micronaut application the work is shifted to a blocking I/O thread pool. 2 | 3 | When using https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/transaction/annotation/Transactional.html[@Transactional] the Hibernate `Session` will only be open for the duration of this method execution and then will automatically be closed. This ensures that the blocking operation is kept as short as possible. 4 | 5 | There is no notion of OpenSessionInView (OSIV) in Micronaut and never will be, since it is https://vladmihalcea.com/the-open-session-in-view-anti-pattern/[sub-optimal and not recommended]. You should optimize the queries that you write to return all the necessary data Micronaut will need to encode your objects into JSON either by using the appropriate join queries or using a https://vladmihalcea.com/the-best-way-to-map-a-projection-query-to-a-dto-with-jpa-and-hibernate/[data transfer object (DTO)]. 6 | 7 | If you encounter a `LazyInitializationException` when returning a Hibernate entity from a method it is an indication that your query is suboptimal and you should perform a join. 8 | -------------------------------------------------------------------------------- /src/main/docs/guide/hibernate/hibernate-proxies.adoc: -------------------------------------------------------------------------------- 1 | Hibernate uses a proxy object to implement lazy loading with a default implementation generating a proxy during the runtime. 2 | 3 | This has a few disadvantages: 4 | 5 | * Runtime class generation can affect startup and runtime performance 6 | * Environments like GraalVM don't support it 7 | 8 | If you wish to use lazy entity associations and avoid runtime proxies you can enable compile-time proxies: 9 | [source,yaml] 10 | ---- 11 | jpa: 12 | default: 13 | compile-time-hibernate-proxies: true 14 | ---- 15 | 16 | Compile-time proxies require for an entity which needs to have a proxy to be annotated with `@GenerateProxy`: 17 | 18 | For example: 19 | 20 | [source,java] 21 | ---- 22 | @Entity 23 | public class Pet { 24 | 25 | @ManyToOne(fetch = FetchType.LAZY) 26 | private Owner owner; 27 | 28 | //... 29 | } 30 | ---- 31 | 32 | The entity `Owner` needs to be annotated with `@GenerateProxy` to have a proxy generated and the compile-time. 33 | 34 | [source,java] 35 | ---- 36 | @Entity 37 | @GenerateProxy 38 | public class Owner { 39 | //... 40 | } 41 | ---- 42 | 43 | [NOTE] 44 | Compile-time proxies are enabled by default for GraalVM environment. 45 | -------------------------------------------------------------------------------- /src/main/docs/guide/introduction.adoc: -------------------------------------------------------------------------------- 1 | This project includes modules to support SQL Database access in Micronaut. 2 | 3 | -------------------------------------------------------------------------------- /src/main/docs/guide/jasync.adoc: -------------------------------------------------------------------------------- 1 | Micronaut supports asynchronous access to PostgreSQL and MySQL using https://github.com/jasync-sql/jasync-sql[jasync-sql], allowing to handle many database connections with a single thread. 2 | -------------------------------------------------------------------------------- /src/main/docs/guide/jasync/jasync-healthchecks.adoc: -------------------------------------------------------------------------------- 1 | When the `jasync-sql` module is activated a api:configuration.jasync.health.JasyncHealthIndicator[] is activated resulting in the `/health` endpoint and api:health.CurrentHealthStatus[] interface resolving the health of the connection. 2 | 3 | The only configuration option supported is to enable or disable the indicator by the `endpoints.health.jasync.enabled` key. 4 | 5 | See the section on the https://docs.micronaut.io/latest/guide/index.html#healthEndpoint[Health Endpoint] for more information. 6 | -------------------------------------------------------------------------------- /src/main/docs/guide/jdbc.adoc: -------------------------------------------------------------------------------- 1 | Java data sources can be configured for one of four currently provided implementations. Apache DBCP2, Hikari, Tomcat, and Oracle Universal Connection Pool are supported by default. 2 | 3 | [TIP] 4 | .Using the CLI 5 | ==== 6 | If you are creating your project using the Micronaut CLI, supply one of the `jdbc-tomcat`, `jdbc-hikari`, `jdbc-dbcp`, or `jdbc-ucp` features to preconfigure a simple JDBC connection in your project, along with a default H2 database driver: 7 | ---- 8 | $ mn create-app my-app --features jdbc-tomcat 9 | ---- 10 | ==== 11 | 12 | To get started, simply add a dependency to one of the JDBC configurations that corresponds to the implementation you would like to use. Choose one of the following: 13 | 14 | dependency:micronaut-jdbc-tomcat[groupId="io.micronaut.sql", scope="runtime"] 15 | 16 | dependency:micronaut-jdbc-hikari[groupId="io.micronaut.sql", scope="runtime"] 17 | 18 | dependency:micronaut-jdbc-dbcp[groupId="io.micronaut.sql", scope="runtime"] 19 | 20 | dependency:micronaut-jdbc-ucp[groupId="io.micronaut.sql", scope="runtime"] 21 | 22 | You also need to add a JDBC driver dependency to your classpath. For example to add the http://www.h2database.com[H2 In-Memory Database]: 23 | 24 | dependency:h2[groupId="com.h2database", scope="runtime"] 25 | 26 | -------------------------------------------------------------------------------- /src/main/docs/guide/jdbc/jdbc-disable.adoc: -------------------------------------------------------------------------------- 1 | You can disable Micronaut Data Sources, for example in a test, by setting `datasources..enabled` to `false`. 2 | 3 | Please note that such test should have `@MicronautTest(transactional = false)` because required transaction beans won't be available because there is no datasource and connection available in the context. 4 | 5 | NOTE: Micronaut SQL 5.7.0 allowed disabling datasources via setting `datasources.enabled` to `false. That it is no longer supported. If you have multiple dataousrces you have to disable them all individually. -------------------------------------------------------------------------------- /src/main/docs/guide/jdbc/jdbc-healthchecks.adoc: -------------------------------------------------------------------------------- 1 | Once you have configured a JDBC `DataSource` the https://docs.micronaut.io/latest/api/io/micronaut/management/health/indicator/jdbc/JdbcIndicator.html[JdbcIndicator] is activated resulting in the `/health` endpoint and https://docs.micronaut.io/latest/api/io/micronaut/health/CurrentHealthStatus.html[CurrentHealthStatus] interface resolving the health of the JDBC connection. 2 | 3 | See the section on the https://docs.micronaut.io/latest/guide/index.html#healthEndpoint[Health Endpoint] for more information. 4 | -------------------------------------------------------------------------------- /src/main/docs/guide/jdbc/jdbc-multiple-datasources.adoc: -------------------------------------------------------------------------------- 1 | To register more than one data source, simply configure them under different names. 2 | 3 | [configuration] 4 | ---- 5 | datasources: 6 | default: 7 | ... 8 | warehouse: 9 | ... 10 | ---- 11 | 12 | When injecting link:{jdkapi}/java.sql/javax/sql/DataSource.html[DataSource] beans, the one with the name "default" will be injected unless the injection is qualified with the configured name. If no configuration is named "default", none of the beans will be primary and thus all injections must be qualified. For example: 13 | 14 | [source,java] 15 | ---- 16 | @Inject DataSource dataSource // "default" will be injected 17 | @Inject @Named("warehouse") DataSource dataSource // "warehouse" will be injected 18 | ---- 19 | -------------------------------------------------------------------------------- /src/main/docs/guide/jdbi.adoc: -------------------------------------------------------------------------------- 1 | Micronaut supports automatically configuring https://jdbi.org/[Jdbi] library for convenient, idiomatic access to relational data. 2 | 3 | To configure the Jdbi library you should first add the `jdbi` module to your classpath: 4 | 5 | dependency:micronaut-jdbi[groupId="io.micronaut.sql"] 6 | 7 | You should then <>. 8 | For each registered `DataSource`, Micronaut will configure the following Jdbi beans using api:configuration.jdbi.JdbiFactory[]: 9 | 10 | * link:{jdbiapi}/org/jdbi/v3/core/Jdbi.html[Jdbi] - the `Jdbi` instance 11 | 12 | If Spring transaction management is in use, it will additionally create the following beans : 13 | 14 | * api:configuration.jdbi.spring.SpringTransactionHandler[SpringTransactionHandler] for each Spring `PlatformTransactionManager` 15 | -------------------------------------------------------------------------------- /src/main/docs/guide/jdbi/jdbi-provider-beans.adoc: -------------------------------------------------------------------------------- 1 | You can define additional beans which will be used when the `Jdbi` object is created. 2 | Only beans with a `Named` qualifier name with the same name as the data source name will be used. 3 | 4 | Micronaut will look for the following bean types: 5 | 6 | * link:{jdbiapi}/org/jdbi/v3/core/transaction/TransactionHandler.html[TransactionHandler] 7 | * link:{jdbiapi}/org/jdbi/v3/core/statement/StatementBuilderFactory.html[StatementBuilderFactory] 8 | * api:configuration.jdbi.JdbiCustomizer[JdbiCustomizer] 9 | -------------------------------------------------------------------------------- /src/main/docs/guide/jooq.adoc: -------------------------------------------------------------------------------- 1 | Micronaut supports automatically configuring http://www.jooq.org/[jOOQ] library for fluent, typesafe SQL query construction. 2 | 3 | To configure jOOQ library you should first add `jooq` module to your classpath: 4 | 5 | dependency:micronaut-jooq[groupId="io.micronaut.sql"] 6 | 7 | You should then <>. 8 | For each registered `DataSource`, Micronaut will configure the following jOOQ beans using api:configuration.jooq.JooqConfigurationFactory[]: 9 | 10 | * link:{jooqapi}/org/jooq/Configuration.html[Configuration] - jOOQ `Configuration` 11 | * link:{jooqapi}/org/jooq/DSLContext.html[DSLContext] - jOOQ `DSLContext` 12 | 13 | If Spring transaction management is in use, it will additionally create the following beans : 14 | 15 | * api:configuration.jooq.JooqExceptionTranslatorProvider[] for each `DataSource` 16 | * api:configuration.jooq.SpringTransactionProvider[] for each Spring `PlatformTransactionManager` 17 | 18 | -------------------------------------------------------------------------------- /src/main/docs/guide/jooq/jooq-dialect.adoc: -------------------------------------------------------------------------------- 1 | Micronaut will attempt to detect database link:{jooqapi}/org/jooq/SQLDialect.html[SQLDialect] automatically. 2 | 3 | If this does not work as desired, SQL dialect can be provided manually via configuration properties. The following example configures dialect for `default` datasource: 4 | 5 | [configuration] 6 | .Configuring SQL dialect 7 | ---- 8 | jooq: 9 | datasources: 10 | default: 11 | sql-dialect: 'POSTGRES' 12 | ---- 13 | -------------------------------------------------------------------------------- /src/main/docs/guide/jooq/jooq-graalvm.adoc: -------------------------------------------------------------------------------- 1 | To use JOOQ in a native image it is necessary to declare the `Record` classes for reflection. 2 | The easiest way to do it is configure jOOQ to annotate the generated classes with the JPA annotations enabling the 3 | option `jpaAnnotations`. This way Micronaut will be able to detect them and automatically generate the reflection 4 | configuration that GraalVM needs. 5 | 6 | For example, if you are using https://github.com/etiennestuder/gradle-jooq-plugin[this gradle plugin] you can add the 7 | following: 8 | 9 | [source,groovy] 10 | ---- 11 | jooq { 12 | devDb(sourceSets.main) { 13 | ... 14 | generator { 15 | ... 16 | generate { 17 | jpaAnnotations = true // <1> 18 | } 19 | } 20 | } 21 | } 22 | ---- 23 | <1> Configure jOOQ to generate the JPA annotations. 24 | 25 | There is also built-in support for using https://simpleflatmapper.org/[SimpleFlatMapper] with jOOQ in a native-image. No 26 | additional configuration is needed, just adding the SimpleFlatMapper dependency: 27 | 28 | dependency:org.simpleflatmapper:sfm-jdbc[version="8.2.3"] 29 | 30 | 31 | [NOTE] 32 | Find more information in the https://www.jooq.org/doc/latest/manual/code-generation/codegen-advanced/codegen-config-generate/codegen-generate-annotations[jOOQ documentation]. 33 | -------------------------------------------------------------------------------- /src/main/docs/guide/jooq/jooq-jsonb.adoc: -------------------------------------------------------------------------------- 1 | If you don't register bean of type link:{jooqapi}/org/jooq/ConverterProvider.html[ConverterProvider] and provide following configuration, `JsonConverterProvider` will be used, which uses Micronaut configured `JsonMapper` for converting from and to types JSON and JSONB. 2 | 3 | .Configuring Micronaut Json converter 4 | [source,yaml] 5 | ---- 6 | jooq: 7 | datasources: 8 | default: 9 | json-converter-enabled: true 10 | ---- 11 | -------------------------------------------------------------------------------- /src/main/docs/guide/jooq/jooq-provider-beans.adoc: -------------------------------------------------------------------------------- 1 | You can define additional beans which will be used when jOOQ `Configuration` is created. 2 | Only beans with the same name qualifier as the data source name will be used. 3 | 4 | Micronaut will look for the following bean types: 5 | 6 | * link:{jooqapi}/org/jooq/conf/Settings.html[Settings] 7 | * link:{jooqapi}/org/jooq/TransactionProvider.html[TransactionProvider] 8 | * link:{jooqapi}/org/jooq/ConnectionProvider.html[ConnectionProvider] 9 | * link:{jooqapi}/org/jooq/ExecutorProvider.html[ExecutorProvider] 10 | * link:{jooqapi}/org/jooq/RecordMapperProvider.html[RecordMapperProvider] 11 | * link:{jooqapi}/org/jooq/RecordUnmapperProvider.html[RecordUnmapperProvider] 12 | * link:{jooqapi}/org/jooq/MetaProvider.html[MetaProvider] 13 | * link:{jooqapi}/org/jooq/ConverterProvider.html[ConverterProvider] 14 | * link:{jooqapi}/org/jooq/ExecuteListenerProvider.html[ExecuteListenerProvider] 15 | * link:{jooqapi}/org/jooq/RecordListenerProvider.html[RecordListenerProvider] 16 | * link:{jooqapi}/org/jooq/VisitListenerProvider.html[VisitListenerProvider] 17 | * link:{jooqapi}/org/jooq/TransactionListenerProvider.html[TransactionListenerProvider] 18 | * link:{jooqapi}/org/jooq/DiagnosticsListenerProvider.html[DiagnosticsListenerProvider] 19 | -------------------------------------------------------------------------------- /src/main/docs/guide/releaseHistory.adoc: -------------------------------------------------------------------------------- 1 | For this project, you can find a list of releases (with release notes) here: 2 | 3 | https://github.com/{githubSlug}/releases[https://github.com/{githubSlug}/releases] 4 | -------------------------------------------------------------------------------- /src/main/docs/guide/repository.adoc: -------------------------------------------------------------------------------- 1 | You can find the source code of this project in this repository: 2 | 3 | https://github.com/{githubSlug}[https://github.com/{githubSlug}] -------------------------------------------------------------------------------- /src/main/docs/guide/vertxmysqlclient/vertxmysqlclient-healthchecks.adoc: -------------------------------------------------------------------------------- 1 | When the `vertx-mysql-client` module is activated a api:configuration.vertx.mysql.client.health.MySQLClientPoolHealthIndicator[] is activated resulting in the `/health` endpoint and api:health.CurrentHealthStatus[] interface resolving the health of the MySQL connection. 2 | 3 | The only configuration option supported is to enable or disable the indicator by the `endpoints.health.vertx.mysql.client.enabled` key. 4 | 5 | See the section on the destroy() { 38 | return Flux.concat( 39 | petRepository.destroy(), 40 | ownerRepository.destroy() 41 | ).then(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /tests/common-reactive/src/main/java/example/reactive/IOwnerRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package example.reactive; 17 | 18 | import example.domain.IOwner; 19 | import reactor.core.publisher.Flux; 20 | import reactor.core.publisher.Mono; 21 | 22 | import jakarta.transaction.Transactional; 23 | 24 | public interface IOwnerRepository { 25 | 26 | default Mono init() { 27 | return Mono.empty(); 28 | } 29 | 30 | default Mono destroy() { 31 | return Mono.empty(); 32 | } 33 | 34 | IOwner create(); 35 | 36 | @Transactional(Transactional.TxType.MANDATORY) 37 | Mono save(IOwner entity); 38 | 39 | @Transactional(Transactional.TxType.MANDATORY) 40 | Mono delete(IOwner entity); 41 | 42 | Mono findById(Long id); 43 | 44 | Mono findByName(String name); 45 | 46 | Flux findAll(); 47 | } 48 | -------------------------------------------------------------------------------- /tests/common-reactive/src/main/java/example/reactive/IPetRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package example.reactive; 17 | 18 | import example.domain.IPet; 19 | import reactor.core.publisher.Flux; 20 | import reactor.core.publisher.Mono; 21 | 22 | import jakarta.transaction.Transactional; 23 | 24 | public interface IPetRepository { 25 | 26 | default Mono init() { 27 | return Mono.empty(); 28 | } 29 | 30 | default Mono destroy() { 31 | return Mono.empty(); 32 | } 33 | 34 | IPet create(); 35 | 36 | @Transactional(Transactional.TxType.MANDATORY) 37 | Mono save(IPet pet); 38 | 39 | @Transactional(Transactional.TxType.MANDATORY) 40 | Mono delete(IPet pet); 41 | 42 | Mono findByName(String name); 43 | 44 | Flux findAll(); 45 | } 46 | -------------------------------------------------------------------------------- /tests/common-reactive/src/main/java/example/reactive/Mapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package example.reactive; 17 | 18 | import example.dto.OwnerDto; 19 | import example.dto.PetDto; 20 | import example.domain.IOwner; 21 | import example.domain.IPet; 22 | import jakarta.inject.Singleton; 23 | 24 | @Singleton 25 | public class Mapper { 26 | 27 | public PetDto toPetDto(IPet pet) { 28 | PetDto petDto = new PetDto(); 29 | petDto.setId(pet.getId()); 30 | petDto.setName(pet.getName()); 31 | petDto.setType(pet.getType()); 32 | petDto.setOwner(toOwnerDto(pet.getOwner())); 33 | return petDto; 34 | } 35 | 36 | public OwnerDto toOwnerDto(IOwner owner) { 37 | OwnerDto ownerDto = new OwnerDto(); 38 | ownerDto.setAge(owner.getAge()); 39 | ownerDto.setId(owner.getId()); 40 | ownerDto.setName(owner.getName()); 41 | return ownerDto; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /tests/common-sync/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'io.micronaut.build.internal.test-library' 3 | } 4 | 5 | dependencies { 6 | annotationProcessor(mnSerde.micronaut.serde.processor) 7 | implementation mn.micronaut.http 8 | implementation mn.micronaut.runtime 9 | api(projects.micronautTests.micronautCommon) 10 | api(mnData.micronaut.data.tx) 11 | 12 | implementation(mnSerde.micronaut.serde.jackson) 13 | testImplementation(mnSerde.micronaut.serde.jackson) 14 | 15 | runtimeOnly(mn.snakeyaml) 16 | } 17 | -------------------------------------------------------------------------------- /tests/common-sync/src/main/java/example/sync/DestroyController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package example.sync; 17 | 18 | import io.micronaut.http.annotation.Controller; 19 | import io.micronaut.http.annotation.Get; 20 | import io.micronaut.transaction.annotation.Transactional; 21 | import org.slf4j.Logger; 22 | import org.slf4j.LoggerFactory; 23 | 24 | @Controller("/destroy") 25 | class DestroyController { 26 | 27 | private final IOwnerRepository ownerRepository; 28 | private final IPetRepository petRepository; 29 | 30 | DestroyController(IOwnerRepository ownerRepository, IPetRepository petRepository) { 31 | this.ownerRepository = ownerRepository; 32 | this.petRepository = petRepository; 33 | } 34 | 35 | @Get 36 | @Transactional 37 | void destroy() { 38 | petRepository.findAll().forEach(it -> petRepository.delete(it)); 39 | ownerRepository.findAll().forEach(it -> ownerRepository.delete(it)); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /tests/common-sync/src/main/java/example/sync/IOwnerRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package example.sync; 17 | 18 | import example.domain.IOwner; 19 | 20 | import java.util.Collection; 21 | import java.util.Optional; 22 | 23 | public interface IOwnerRepository { 24 | 25 | IOwner create(); 26 | 27 | void save(IOwner entity); 28 | 29 | void delete(IOwner entity); 30 | 31 | IOwner findById(Long id); 32 | 33 | Collection findAll(); 34 | 35 | Optional findByName(String name); 36 | } 37 | -------------------------------------------------------------------------------- /tests/common-sync/src/main/java/example/sync/IPetRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package example.sync; 17 | 18 | import example.domain.IPet; 19 | 20 | import java.util.Collection; 21 | import java.util.Optional; 22 | 23 | public interface IPetRepository { 24 | 25 | IPet create(); 26 | 27 | void save(IPet pet); 28 | 29 | void delete(IPet pet); 30 | 31 | Collection findAll(); 32 | 33 | Optional findByName(String name); 34 | } 35 | -------------------------------------------------------------------------------- /tests/common-sync/src/main/java/example/sync/Mapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package example.sync; 17 | 18 | import example.dto.OwnerDto; 19 | import example.dto.PetDto; 20 | import example.domain.IOwner; 21 | import example.domain.IPet; 22 | import jakarta.inject.Singleton; 23 | 24 | 25 | @Singleton 26 | public class Mapper { 27 | 28 | public PetDto toPetDto(IPet pet) { 29 | PetDto petDto = new PetDto(); 30 | petDto.setId(pet.getId()); 31 | petDto.setName(pet.getName()); 32 | petDto.setType(pet.getType()); 33 | petDto.setOwner(toOwnerDto(pet.getOwner())); 34 | return petDto; 35 | } 36 | 37 | public OwnerDto toOwnerDto(IOwner owner) { 38 | OwnerDto ownerDto = new OwnerDto(); 39 | ownerDto.setAge(owner.getAge()); 40 | ownerDto.setId(owner.getId()); 41 | ownerDto.setName(owner.getName()); 42 | return ownerDto; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /tests/common-tests/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'io.micronaut.build.internal.test-library' 3 | } 4 | 5 | dependencies { 6 | api mn.micronaut.http.client 7 | api mnTest.micronaut.test.junit5 8 | api mnReactor.micronaut.reactor 9 | api(projects.micronautTests.micronautCommon) 10 | api libs.micronaut.testresources.client 11 | } 12 | -------------------------------------------------------------------------------- /tests/common/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'io.micronaut.build.internal.test-library' 3 | } 4 | 5 | dependencies { 6 | annotationProcessor(mnSerde.micronaut.serde.processor) 7 | api(mnSerde.micronaut.serde.api) 8 | runtimeOnly(mn.snakeyaml) 9 | } 10 | -------------------------------------------------------------------------------- /tests/common/src/main/java/example/Application.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package example; 17 | 18 | import io.micronaut.runtime.Micronaut; 19 | 20 | public class Application { 21 | 22 | public static void main(String[] args) { 23 | Micronaut.run(Application.class); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /tests/common/src/main/java/example/domain/IOwner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package example.domain; 17 | 18 | import io.micronaut.serde.annotation.Serdeable; 19 | 20 | @Serdeable 21 | public interface IOwner { 22 | 23 | void setId(Long id); 24 | 25 | Long getId(); 26 | 27 | void setName(String fred); 28 | 29 | String getName(); 30 | 31 | void setAge(int age); 32 | 33 | int getAge(); 34 | 35 | default String asString() { 36 | return "Owner{" + 37 | "id=" + getId() + 38 | ", name='" + getName() + '\'' + 39 | ", age=" + getAge() + 40 | '}'; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /tests/common/src/main/java/example/domain/IPet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package example.domain; 17 | 18 | import io.micronaut.core.annotation.Introspected; 19 | 20 | public interface IPet { 21 | 22 | Long getId(); 23 | 24 | void setId(Long id); 25 | 26 | IOwner getOwner(); 27 | 28 | void setOwner(IOwner owner); 29 | 30 | String getName(); 31 | 32 | void setName(String name); 33 | 34 | PetType getType(); 35 | 36 | void setType(PetType type); 37 | 38 | @Introspected 39 | enum PetType { 40 | DOG, 41 | CAT 42 | } 43 | 44 | default String asString() { 45 | return "Pet{" + 46 | "id=" + getId() + 47 | ", name='" + getName() + '\'' + 48 | ", owner=" + getOwner() + 49 | ", type=" + getType() + 50 | '}'; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /tests/common/src/main/java/example/dto/OwnerDto.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package example.dto; 17 | 18 | import io.micronaut.serde.annotation.Serdeable; 19 | 20 | @Serdeable 21 | public class OwnerDto { 22 | 23 | private Long id; 24 | private String name; 25 | private int age; 26 | 27 | public Long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(Long id) { 32 | this.id = id; 33 | } 34 | 35 | public String getName() { 36 | return name; 37 | } 38 | 39 | public void setName(String name) { 40 | this.name = name; 41 | } 42 | 43 | public int getAge() { 44 | return age; 45 | } 46 | 47 | public void setAge(int age) { 48 | this.age = age; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /tests/common/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | micronaut: 2 | application: 3 | name: graalvm-hibernate-jpa 4 | http: 5 | client: 6 | read-timeout: 60s 7 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-h2/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("io.micronaut.build.internal.test-application-hibernate6") 3 | } 4 | 5 | dependencies { 6 | implementation projects.micronautTests.micronautHibernate6.micronautHibernate6SyncCommon 7 | testImplementation projects.micronautTests.micronautCommonTests 8 | 9 | runtimeOnly projects.micronautJdbcHikari 10 | 11 | runtimeOnly libs.managed.h2 12 | } 13 | 14 | configurations { 15 | all*.exclude module: "javassist" 16 | } 17 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-h2/src/test/java/example/hibernate6/sync/H2App.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package example.hibernate6.sync; 17 | 18 | import example.sync.AbstractApp; 19 | import io.micronaut.context.annotation.Property; 20 | import io.micronaut.test.extensions.junit5.annotation.MicronautTest; 21 | 22 | @MicronautTest 23 | @Property(name = "datasources.default.url", value = "jdbc:h2:mem:default;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE") 24 | @Property(name = "jpa.default.properties.hibernate.dialect", value = "org.hibernate.dialect.H2Dialect") 25 | public class H2App extends AbstractApp { 26 | } 27 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-h2/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-mariadb/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("io.micronaut.build.internal.test-application-hibernate6") 3 | } 4 | 5 | dependencies { 6 | implementation projects.micronautTests.micronautHibernate6.micronautHibernate6SyncCommon 7 | testImplementation projects.micronautTests.micronautCommonTests 8 | 9 | runtimeOnly projects.micronautJdbcHikari 10 | 11 | runtimeOnly libs.managed.mariadb.java.client 12 | } 13 | 14 | configurations { 15 | all*.exclude module: "javassist" 16 | } 17 | 18 | micronaut { 19 | testResources { 20 | additionalModules.add(JDBC_MARIADB) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-mariadb/src/test/java/example/hibernate6/sync/MariaDBApp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package example.hibernate6.sync; 17 | 18 | import example.sync.AbstractApp; 19 | import io.micronaut.context.annotation.Property; 20 | import io.micronaut.test.extensions.junit5.annotation.MicronautTest; 21 | 22 | @MicronautTest 23 | @Property(name = "datasources.default.db-type", value = "mariadb") 24 | @Property(name = "jpa.default.properties.hibernate.dialect", value = "org.hibernate.dialect.MariaDBDialect") 25 | public class MariaDBApp extends AbstractApp { 26 | } 27 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-mariadb/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-mssql/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("io.micronaut.build.internal.test-application-hibernate6") 3 | } 4 | 5 | dependencies { 6 | implementation projects.micronautTests.micronautHibernate6.micronautHibernate6SyncCommon 7 | testImplementation projects.micronautTests.micronautCommonTests 8 | 9 | runtimeOnly projects.micronautJdbcHikari 10 | 11 | runtimeOnly libs.managed.mssql.jdbc 12 | } 13 | 14 | configurations { 15 | all*.exclude module: "javassist" 16 | } 17 | 18 | micronaut { 19 | testResources { 20 | additionalModules.add(JDBC_MSSQL) 21 | } 22 | } 23 | 24 | graalvmNative { 25 | binaries { 26 | all { 27 | buildArgs.add("-H:+AddAllCharsets") 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-mssql/src/test/java/example/hibernate6/sync/MSSQLApp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package example.hibernate6.sync; 17 | 18 | import example.sync.AbstractApp; 19 | import io.micronaut.context.annotation.Property; 20 | import io.micronaut.test.extensions.junit5.annotation.MicronautTest; 21 | 22 | @MicronautTest 23 | @Property(name = "datasources.default.db-type", value = "mssql") 24 | @Property(name = "jpa.default.properties.hibernate.dialect", value = "org.hibernate.dialect.SQLServerDialect") 25 | public class MSSQLApp extends AbstractApp { 26 | } 27 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-mssql/src/test/resources/application-test.yml: -------------------------------------------------------------------------------- 1 | test-resources: 2 | containers: 3 | mssql: 4 | accept-license: true 5 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-mssql/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-mysql-disabled/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("io.micronaut.build.internal.test-application-hibernate6") 3 | } 4 | 5 | dependencies { 6 | implementation projects.micronautHibernateReactive 7 | testImplementation projects.micronautTests.micronautCommonTests 8 | 9 | runtimeOnly projects.micronautJdbcHikari 10 | runtimeOnly(libs.managed.mysql.connector.j) 11 | } 12 | 13 | configurations { 14 | all*.exclude module: "javassist" 15 | } 16 | 17 | micronaut { 18 | testResources { 19 | additionalModules.add(JDBC_MYSQL) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-mysql-disabled/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | #Fri May 05 17:46:38 CEST 2023 2 | micronaut.application.name=temp 3 | jpa.default.properties.hibernate.hbm2ddl.auto=update 4 | netty.default.allocator.max-order=3 5 | jpa.default.reactive=true 6 | jpa.default.properties.hibernate.connection.db-type=mysql 7 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-mysql-disabled/src/test/java/example/hibernate6/sync/TempTest.java: -------------------------------------------------------------------------------- 1 | package example.hibernate6.sync; 2 | 3 | import io.micronaut.context.annotation.Property; 4 | import io.micronaut.core.util.StringUtils; 5 | import io.micronaut.runtime.EmbeddedApplication; 6 | import io.micronaut.test.extensions.junit5.annotation.MicronautTest; 7 | import jakarta.inject.Inject; 8 | import org.junit.jupiter.api.Assertions; 9 | import org.junit.jupiter.api.Test; 10 | 11 | @Property(name = "jpa.enabled", value = StringUtils.FALSE) 12 | @MicronautTest 13 | class TempTest { 14 | 15 | @Inject 16 | EmbeddedApplication application; 17 | 18 | @Test 19 | void testItWorks() { 20 | Assertions.assertTrue(application.isRunning()); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-mysql-disabled/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-mysql/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("io.micronaut.build.internal.test-application-hibernate6") 3 | } 4 | 5 | dependencies { 6 | implementation projects.micronautTests.micronautHibernate6.micronautHibernate6SyncCommon 7 | testImplementation projects.micronautTests.micronautCommonTests 8 | 9 | runtimeOnly projects.micronautJdbcTomcat 10 | 11 | runtimeOnly(libs.managed.mysql.connector.j) 12 | } 13 | 14 | configurations { 15 | all*.exclude module: "javassist" 16 | } 17 | 18 | micronaut { 19 | testResources { 20 | additionalModules.add(JDBC_MYSQL) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-mysql/src/test/java/example/hibernate6/sync/MySQLApp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package example.hibernate6.sync; 17 | 18 | import example.sync.AbstractApp; 19 | import io.micronaut.context.annotation.Property; 20 | import io.micronaut.test.extensions.junit5.annotation.MicronautTest; 21 | 22 | @MicronautTest 23 | @Property(name = "datasources.default.db-type", value = "mysql") 24 | @Property(name = "jpa.default.properties.hibernate.dialect", value = "org.hibernate.dialect.MySQLDialect") 25 | @Property(name = "test-resources.containers.mysql.image-name", value = "mysql:8.4.5") 26 | public class MySQLApp extends AbstractApp { 27 | } 28 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-mysql/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-oracle/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("io.micronaut.build.internal.test-application-hibernate6") 3 | } 4 | 5 | dependencies { 6 | implementation projects.micronautTests.micronautHibernate6.micronautHibernate6SyncCommon 7 | testImplementation projects.micronautTests.micronautCommonTests 8 | 9 | runtimeOnly projects.micronautJdbcTomcat 10 | 11 | runtimeOnly libs.managed.ojdbc11 12 | } 13 | 14 | configurations { 15 | all*.exclude module: "javassist" 16 | } 17 | 18 | micronaut { 19 | testResources { 20 | additionalModules.add("jdbc-oracle-free") 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-oracle/src/test/java/example/hibernate6/sync/OracleDBApp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package example.hibernate6.sync; 17 | 18 | import example.sync.AbstractApp; 19 | import io.micronaut.context.annotation.Property; 20 | import io.micronaut.test.extensions.junit5.annotation.MicronautTest; 21 | 22 | @MicronautTest 23 | @Property(name = "datasources.default.db-type", value = "oracle") 24 | @Property(name = "datasources.default.driverClassName", value = "oracle.jdbc.OracleDriver") 25 | @Property(name = "jpa.default.properties.hibernate.dialect", value = "org.hibernate.dialect.OracleDialect") 26 | @Property(name = "test-resources.containers.oracle.startup-timeout", value = "600s") 27 | public class OracleDBApp extends AbstractApp { 28 | } 29 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-oracle/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-postgres/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("io.micronaut.build.internal.test-application-hibernate6") 3 | } 4 | 5 | dependencies { 6 | implementation projects.micronautTests.micronautHibernate6.micronautHibernate6SyncCommon 7 | testImplementation projects.micronautTests.micronautCommonTests 8 | 9 | runtimeOnly projects.micronautJdbcTomcat 10 | 11 | runtimeOnly libs.managed.postgresql 12 | } 13 | 14 | configurations { 15 | all*.exclude module: "javassist" 16 | } 17 | 18 | micronaut { 19 | testResources { 20 | additionalModules.add(JDBC_POSTGRESQL) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-postgres/src/test/java/example/hibernate6/sync/PostgresApp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package example.hibernate6.sync; 17 | 18 | import example.sync.AbstractApp; 19 | import io.micronaut.context.annotation.Property; 20 | import io.micronaut.test.extensions.junit5.annotation.MicronautTest; 21 | 22 | @MicronautTest 23 | @Property(name = "datasources.default.db-type", value = "postgres") 24 | @Property(name = "jpa.default.properties.hibernate.dialect", value = "org.hibernate.dialect.PostgreSQLDialect") 25 | public class PostgresApp extends AbstractApp { 26 | } 27 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-postgres/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-reactive-common/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("io.micronaut.build.internal.test-application-hibernate6") 3 | } 4 | 5 | dependencies { 6 | implementation projects.micronautTests.micronautCommonReactive 7 | implementation mnReactor.micronaut.reactor 8 | implementation mn.micronaut.http.client 9 | implementation projects.micronautHibernateReactive 10 | implementation projects.micronautJdbc 11 | implementation mnTest.micronaut.test.junit5 12 | 13 | runtimeOnly(mn.snakeyaml) 14 | runtimeOnly(mnData.micronaut.data.model) 15 | } 16 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-reactive-common/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | micronaut: 2 | application: 3 | name: graalvm-hibernate-jpa 4 | http: 5 | client: 6 | read-timeout: 60s 7 | jackson: 8 | bean-introspection-module: true 9 | jpa: 10 | default: 11 | packages-to-scan: 'example.hibernate6.reactive' 12 | properties: 13 | hibernate: 14 | hbm2ddl: 15 | auto: update 16 | show_sql: true 17 | compileTimeHibernateProxies: true 18 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-reactive-mssql/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("io.micronaut.build.internal.test-application-hibernate6") 3 | } 4 | 5 | dependencies { 6 | implementation projects.micronautTests.micronautHibernate6.micronautHibernate6ReactiveCommon 7 | testImplementation projects.micronautTests.micronautCommonTests 8 | 9 | implementation libs.managed.vertx.mssql.client 10 | 11 | // Testcontainers wait function needs the driver 12 | runtimeOnly libs.managed.mssql.jdbc 13 | } 14 | 15 | micronaut { 16 | testResources { 17 | additionalModules.add(HIBERNATE_REACTIVE_MSSQL) 18 | } 19 | } 20 | 21 | graalvmNative { 22 | binaries.all { 23 | buildArgs.addAll("-H:+AddAllCharsets") 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-reactive-mssql/src/test/java/example/hibernate6/reactive/MSSQLApp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2023 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package example.hibernate6.reactive; 17 | 18 | import example.sync.AbstractApp; 19 | import io.micronaut.context.annotation.Property; 20 | import io.micronaut.test.extensions.junit5.annotation.MicronautTest; 21 | 22 | @MicronautTest(transactional = false) 23 | @Property(name = "jpa.default.properties.hibernate.connection.db-type", value = "mssql") 24 | @Property(name = "jpa.default.reactive", value = "true") 25 | public class MSSQLApp extends AbstractApp { 26 | } 27 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-reactive-mssql/src/test/resources/application-test.yml: -------------------------------------------------------------------------------- 1 | test-resources: 2 | containers: 3 | mssql: 4 | accept-license: true 5 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-reactive-mssql/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-reactive-mysql/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("io.micronaut.build.internal.test-application-hibernate6") 3 | } 4 | 5 | dependencies { 6 | implementation projects.micronautTests.micronautHibernate6.micronautHibernate6ReactiveCommon 7 | testImplementation projects.micronautTests.micronautCommonTests 8 | 9 | // implementation projects.vertxMysqlClient 10 | implementation libs.managed.vertx.mysql.client 11 | 12 | // Testcontainers wait function needs the driver 13 | runtimeOnly(libs.managed.mysql.connector.j) 14 | } 15 | 16 | micronaut { 17 | testResources { 18 | additionalModules.add(HIBERNATE_REACTIVE_MYSQL) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-reactive-mysql/src/test/java/example/hibernate6/reactive/MySQLApp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2023 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package example.hibernate6.reactive; 17 | 18 | import example.sync.AbstractApp; 19 | import io.micronaut.context.annotation.Property; 20 | import io.micronaut.test.extensions.junit5.annotation.MicronautTest; 21 | 22 | @MicronautTest(transactional = false) 23 | @Property(name = "jpa.default.properties.hibernate.connection.db-type", value = "mysql") 24 | @Property(name = "jpa.default.reactive", value = "true") 25 | @Property(name = "test-resources.containers.mysql.image-name", value = "mysql:8.4.5") 26 | public class MySQLApp extends AbstractApp { 27 | } 28 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-reactive-mysql/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-reactive-oracle/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("io.micronaut.build.internal.test-application-hibernate6") 3 | } 4 | 5 | dependencies { 6 | implementation projects.micronautTests.micronautHibernate6.micronautHibernate6ReactiveCommon 7 | testImplementation projects.micronautTests.micronautCommonTests 8 | 9 | implementation libs.managed.vertx.oracle.client 10 | } 11 | 12 | micronaut { 13 | testResources { 14 | additionalModules.add("hibernate-reactive-oracle-free") 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-reactive-oracle/src/test/java/example/hibernate6/reactive/OracleDBApp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2023 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package example.hibernate6.reactive; 17 | 18 | import example.sync.AbstractApp; 19 | import io.micronaut.context.annotation.Property; 20 | import io.micronaut.test.extensions.junit5.annotation.MicronautTest; 21 | 22 | @MicronautTest(transactional = false) 23 | @Property(name = "jpa.default.properties.hibernate.connection.db-type", value = "oracle") 24 | @Property(name = "jpa.default.reactive", value = "true") 25 | @Property(name = "test-resources.containers.oracle.startup-timeout", value = "600s") 26 | public class OracleDBApp extends AbstractApp { 27 | } 28 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-reactive-oracle/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-reactive-postgres/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("io.micronaut.build.internal.test-application-hibernate6") 3 | } 4 | 5 | dependencies { 6 | implementation projects.micronautTests.micronautHibernate6.micronautHibernate6ReactiveCommon 7 | testImplementation projects.micronautTests.micronautCommonTests 8 | 9 | implementation libs.managed.vertx.pg.client 10 | } 11 | 12 | micronaut { 13 | testResources { 14 | additionalModules.add(HIBERNATE_REACTIVE_POSTGRESQL) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-reactive-postgres/src/test/java/example/hibernate6/reactive/PostgresApp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2023 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package example.hibernate6.reactive; 17 | 18 | import example.sync.AbstractApp; 19 | import io.micronaut.context.annotation.Property; 20 | import io.micronaut.test.extensions.junit5.annotation.MicronautTest; 21 | 22 | @MicronautTest(transactional = false) 23 | @Property(name = "jpa.default.properties.hibernate.connection.db-type", value = "postgres") 24 | @Property(name = "jpa.default.reactive", value = "true") 25 | public class PostgresApp extends AbstractApp { 26 | } 27 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-reactive-postgres/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-sync-common/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("io.micronaut.build.internal.test-application-hibernate6") 3 | } 4 | 5 | dependencies { 6 | implementation projects.micronautTests.micronautCommonSync 7 | implementation projects.micronautHibernateJpa 8 | implementation mnTest.micronaut.test.junit5 9 | 10 | runtimeOnly(mn.snakeyaml) 11 | runtimeOnly(mnData.micronaut.data.model) 12 | } 13 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-sync-common/src/main/java/example/hibernate6/sync/TestController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package example.hibernate6.sync; 17 | 18 | import io.micronaut.http.annotation.Controller; 19 | import io.micronaut.http.annotation.Get; 20 | 21 | @Controller("/test-proxies") 22 | class TestController { 23 | 24 | @Get 25 | void init() { 26 | try { 27 | Class.forName("net.bytebuddy.ByteBuddy"); 28 | // ignore 29 | } catch (ClassNotFoundException e) { 30 | throw new IllegalStateException("ByteBuddy should be present on classpath"); 31 | } 32 | try { 33 | Class.forName("javassist.util.proxy.ProxyFactory"); 34 | throw new IllegalStateException("Javassist shouldn't be present on classpath"); 35 | } catch (ClassNotFoundException e) { 36 | // Ignore 37 | } 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /tests/hibernate6/hibernate6-sync-common/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | micronaut: 2 | application: 3 | name: graalvm-hibernate-jpa 4 | http: 5 | client: 6 | read-timeout: 60s 7 | jpa: 8 | default: 9 | properties: 10 | hibernate: 11 | hbm2ddl: 12 | auto: update 13 | show_sql: true 14 | compileTimeHibernateProxies: true 15 | -------------------------------------------------------------------------------- /tests/jdbc-dbcp-tests/jdbc-dbcp-postgres/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'io.micronaut.build.internal.test-application' 3 | } 4 | 5 | dependencies { 6 | implementation projects.micronautJdbcDbcp 7 | implementation projects.micronautTests.micronautCommonSync 8 | 9 | runtimeOnly libs.managed.postgresql 10 | 11 | testImplementation projects.micronautTests.micronautCommonTests 12 | testImplementation(mnData.micronaut.data.tx.jdbc) 13 | } 14 | 15 | micronaut { 16 | testResources { 17 | additionalModules.add(JDBC_POSTGRESQL) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tests/jdbc-dbcp-tests/jdbc-dbcp-postgres/src/main/java/example/jdbc/ucp/sync/Owner.java: -------------------------------------------------------------------------------- 1 | package example.jdbc.ucp.sync; 2 | 3 | import example.domain.IOwner; 4 | import io.micronaut.core.annotation.Creator; 5 | import io.micronaut.serde.annotation.Serdeable; 6 | 7 | @Serdeable 8 | public class Owner implements IOwner { 9 | 10 | private Long id; 11 | private String name; 12 | private int age; 13 | 14 | Owner() { 15 | } 16 | 17 | @Creator 18 | public Owner(Long id, String name, int age) { 19 | this.id = id; 20 | this.name = name; 21 | this.age = age; 22 | } 23 | 24 | @Override 25 | public Long getId() { 26 | return id; 27 | } 28 | 29 | public void setId(Long id) { 30 | this.id = id; 31 | } 32 | 33 | @Override 34 | public String getName() { 35 | return name; 36 | } 37 | 38 | @Override 39 | public void setName(String name) { 40 | this.name = name; 41 | } 42 | 43 | @Override 44 | public int getAge() { 45 | return age; 46 | } 47 | 48 | @Override 49 | public void setAge(int age) { 50 | this.age = age; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /tests/jdbc-dbcp-tests/jdbc-dbcp-postgres/src/main/java/example/jdbc/ucp/sync/Pet.java: -------------------------------------------------------------------------------- 1 | package example.jdbc.ucp.sync; 2 | 3 | import example.domain.IOwner; 4 | import example.domain.IPet; 5 | import io.micronaut.core.annotation.Creator; 6 | import io.micronaut.core.annotation.Nullable; 7 | import io.micronaut.serde.annotation.Serdeable; 8 | 9 | @Serdeable 10 | public class Pet implements IPet { 11 | 12 | private Long id; 13 | private String name; 14 | private PetType type; 15 | private Owner owner; 16 | 17 | Pet() { 18 | } 19 | 20 | @Creator 21 | public Pet(Long id, String name, @Nullable PetType type, Owner owner) { 22 | this.id = id; 23 | this.name = name; 24 | this.type = type; 25 | this.owner = owner; 26 | } 27 | 28 | @Override 29 | public Long getId() { 30 | return id; 31 | } 32 | 33 | @Override 34 | public void setId(Long id) { 35 | this.id = id; 36 | } 37 | 38 | @Override 39 | public String getName() { 40 | return name; 41 | } 42 | 43 | @Override 44 | public void setName(String name) { 45 | this.name = name; 46 | } 47 | 48 | @Override 49 | public Owner getOwner() { 50 | return owner; 51 | } 52 | 53 | @Override 54 | public void setOwner(IOwner owner) { 55 | this.owner = (Owner) owner; 56 | } 57 | 58 | @Override 59 | public PetType getType() { 60 | return type; 61 | } 62 | 63 | @Override 64 | public void setType(PetType type) { 65 | this.type = type; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /tests/jdbc-dbcp-tests/jdbc-dbcp-postgres/src/test/java/example/jdbc/ucp/sync/PostgresApp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2024 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package example.jdbc.ucp.sync; 17 | 18 | import example.sync.AbstractApp; 19 | import io.micronaut.context.annotation.Property; 20 | import io.micronaut.test.extensions.junit5.annotation.MicronautTest; 21 | 22 | @MicronautTest 23 | @Property(name = "datasources.default.db-type", value = "postgres") 24 | public class PostgresApp extends AbstractApp { 25 | } 26 | 27 | -------------------------------------------------------------------------------- /tests/jdbc-tomcat-tests/jdbc-tomcat-mysql/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'io.micronaut.build.internal.test-application' 3 | } 4 | 5 | dependencies { 6 | implementation projects.micronautJdbcTomcat 7 | implementation projects.micronautTests.micronautCommonSync 8 | 9 | runtimeOnly libs.managed.mysql.connector.j 10 | 11 | testImplementation projects.micronautTests.micronautCommonTests 12 | testImplementation(mnData.micronaut.data.tx.jdbc) 13 | } 14 | 15 | micronaut { 16 | testResources { 17 | additionalModules.add(JDBC_MYSQL) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tests/jdbc-tomcat-tests/jdbc-tomcat-mysql/src/main/java/example/jdbc/tomcat/sync/Owner.java: -------------------------------------------------------------------------------- 1 | package example.jdbc.tomcat.sync; 2 | 3 | import example.domain.IOwner; 4 | import io.micronaut.core.annotation.Creator; 5 | import io.micronaut.serde.annotation.Serdeable; 6 | 7 | @Serdeable 8 | public class Owner implements IOwner { 9 | 10 | private Long id; 11 | private String name; 12 | private int age; 13 | 14 | Owner() { 15 | } 16 | 17 | @Creator 18 | public Owner(Long id, String name, int age) { 19 | this.id = id; 20 | this.name = name; 21 | this.age = age; 22 | } 23 | 24 | @Override 25 | public Long getId() { 26 | return id; 27 | } 28 | 29 | public void setId(Long id) { 30 | this.id = id; 31 | } 32 | 33 | @Override 34 | public String getName() { 35 | return name; 36 | } 37 | 38 | @Override 39 | public void setName(String name) { 40 | this.name = name; 41 | } 42 | 43 | @Override 44 | public int getAge() { 45 | return age; 46 | } 47 | 48 | @Override 49 | public void setAge(int age) { 50 | this.age = age; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /tests/jdbc-tomcat-tests/jdbc-tomcat-mysql/src/main/java/example/jdbc/tomcat/sync/Pet.java: -------------------------------------------------------------------------------- 1 | package example.jdbc.tomcat.sync; 2 | 3 | import example.domain.IOwner; 4 | import example.domain.IPet; 5 | import io.micronaut.core.annotation.Creator; 6 | import io.micronaut.core.annotation.Nullable; 7 | import io.micronaut.serde.annotation.Serdeable; 8 | 9 | @Serdeable 10 | public class Pet implements IPet { 11 | 12 | private Long id; 13 | private String name; 14 | private PetType type; 15 | private Owner owner; 16 | 17 | Pet() { 18 | } 19 | 20 | @Creator 21 | public Pet(Long id, String name, @Nullable PetType type, Owner owner) { 22 | this.id = id; 23 | this.name = name; 24 | this.type = type; 25 | this.owner = owner; 26 | } 27 | 28 | @Override 29 | public Long getId() { 30 | return id; 31 | } 32 | 33 | @Override 34 | public void setId(Long id) { 35 | this.id = id; 36 | } 37 | 38 | @Override 39 | public String getName() { 40 | return name; 41 | } 42 | 43 | @Override 44 | public void setName(String name) { 45 | this.name = name; 46 | } 47 | 48 | @Override 49 | public Owner getOwner() { 50 | return owner; 51 | } 52 | 53 | @Override 54 | public void setOwner(IOwner owner) { 55 | this.owner = (Owner) owner; 56 | } 57 | 58 | @Override 59 | public PetType getType() { 60 | return type; 61 | } 62 | 63 | @Override 64 | public void setType(PetType type) { 65 | this.type = type; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /tests/jdbc-tomcat-tests/jdbc-tomcat-mysql/src/test/java/example/jdbc/tomcat/sync/MySQLApp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2024 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package example.jdbc.tomcat.sync; 17 | 18 | import example.sync.AbstractApp; 19 | import io.micronaut.context.annotation.Property; 20 | import io.micronaut.test.extensions.junit5.annotation.MicronautTest; 21 | 22 | @MicronautTest 23 | @Property(name = "datasources.default.db-type", value = "mysql") 24 | @Property(name = "test-resources.containers.mysql.image-name", value = "mysql:8.4.5") 25 | public class MySQLApp extends AbstractApp { 26 | } 27 | 28 | -------------------------------------------------------------------------------- /tests/jdbc-ucp-tests/jdbc-ucp-oracle/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'io.micronaut.build.internal.test-application' 3 | } 4 | 5 | dependencies { 6 | implementation projects.micronautJdbcUcp 7 | implementation projects.micronautTests.micronautCommonSync 8 | 9 | runtimeOnly libs.managed.ojdbc11 10 | runtimeOnly libs.managed.ucp11 11 | 12 | testImplementation projects.micronautTests.micronautCommonTests 13 | testImplementation(mnData.micronaut.data.tx.jdbc) 14 | } 15 | 16 | micronaut { 17 | testResources { 18 | additionalModules.add("jdbc-oracle-free") 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /tests/jdbc-ucp-tests/jdbc-ucp-oracle/src/main/java/example/jdbc/ucp/sync/Owner.java: -------------------------------------------------------------------------------- 1 | package example.jdbc.ucp.sync; 2 | 3 | import example.domain.IOwner; 4 | import io.micronaut.core.annotation.Creator; 5 | import io.micronaut.serde.annotation.Serdeable; 6 | 7 | @Serdeable 8 | public class Owner implements IOwner { 9 | 10 | private Long id; 11 | private String name; 12 | private int age; 13 | 14 | Owner() { 15 | } 16 | 17 | @Creator 18 | public Owner(Long id, String name, int age) { 19 | this.id = id; 20 | this.name = name; 21 | this.age = age; 22 | } 23 | 24 | @Override 25 | public Long getId() { 26 | return id; 27 | } 28 | 29 | public void setId(Long id) { 30 | this.id = id; 31 | } 32 | 33 | @Override 34 | public String getName() { 35 | return name; 36 | } 37 | 38 | @Override 39 | public void setName(String name) { 40 | this.name = name; 41 | } 42 | 43 | @Override 44 | public int getAge() { 45 | return age; 46 | } 47 | 48 | @Override 49 | public void setAge(int age) { 50 | this.age = age; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /tests/jdbc-ucp-tests/jdbc-ucp-oracle/src/main/java/example/jdbc/ucp/sync/Pet.java: -------------------------------------------------------------------------------- 1 | package example.jdbc.ucp.sync; 2 | 3 | import example.domain.IOwner; 4 | import example.domain.IPet; 5 | import io.micronaut.core.annotation.Creator; 6 | import io.micronaut.core.annotation.Nullable; 7 | import io.micronaut.serde.annotation.Serdeable; 8 | 9 | @Serdeable 10 | public class Pet implements IPet { 11 | 12 | private Long id; 13 | private String name; 14 | private PetType type; 15 | private Owner owner; 16 | 17 | Pet() { 18 | } 19 | 20 | @Creator 21 | public Pet(Long id, String name, @Nullable PetType type, Owner owner) { 22 | this.id = id; 23 | this.name = name; 24 | this.type = type; 25 | this.owner = owner; 26 | } 27 | 28 | @Override 29 | public Long getId() { 30 | return id; 31 | } 32 | 33 | @Override 34 | public void setId(Long id) { 35 | this.id = id; 36 | } 37 | 38 | @Override 39 | public String getName() { 40 | return name; 41 | } 42 | 43 | @Override 44 | public void setName(String name) { 45 | this.name = name; 46 | } 47 | 48 | @Override 49 | public Owner getOwner() { 50 | return owner; 51 | } 52 | 53 | @Override 54 | public void setOwner(IOwner owner) { 55 | this.owner = (Owner) owner; 56 | } 57 | 58 | @Override 59 | public PetType getType() { 60 | return type; 61 | } 62 | 63 | @Override 64 | public void setType(PetType type) { 65 | this.type = type; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /tests/jdbc-ucp-tests/jdbc-ucp-oracle/src/test/java/example/jdbc/ucp/sync/OracleApp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2024 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package example.jdbc.ucp.sync; 17 | 18 | import example.sync.AbstractApp; 19 | import io.micronaut.context.annotation.Property; 20 | import io.micronaut.test.extensions.junit5.annotation.MicronautTest; 21 | 22 | @MicronautTest 23 | @Property(name = "datasources.default.db-type", value = "oracle") 24 | @Property(name = "datasources.default.connection-factory-class-name", value = "oracle.jdbc.pool.OracleDataSource") 25 | @Property(name = "test-resources.containers.oracle.startup-timeout", value = "600s") 26 | @Property(name = "oracle.ucp.destroyOnReload", value = "true") 27 | public class OracleApp extends AbstractApp { 28 | } 29 | 30 | -------------------------------------------------------------------------------- /tests/jdbc-ucp-tests/jdbc-ucp-oracle/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /tests/jooq-tests/jooq-jdbc-postgres/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'io.micronaut.build.internal.test-application' 3 | } 4 | 5 | dependencies { 6 | implementation projects.micronautJooq 7 | implementation projects.micronautTests.micronautCommonSync 8 | 9 | runtimeOnly libs.managed.postgresql 10 | runtimeOnly projects.micronautJdbcHikari 11 | 12 | testImplementation projects.micronautTests.micronautCommonTests 13 | testImplementation(mnData.micronaut.data.tx.jdbc) 14 | } 15 | 16 | micronaut { 17 | testResources { 18 | additionalModules.add(JDBC_POSTGRESQL) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /tests/jooq-tests/jooq-jdbc-postgres/src/main/java/example/jooq/sync/Owner.java: -------------------------------------------------------------------------------- 1 | package example.jooq.sync; 2 | 3 | import example.domain.IOwner; 4 | import io.micronaut.core.annotation.Creator; 5 | import io.micronaut.serde.annotation.Serdeable; 6 | 7 | @Serdeable 8 | public class Owner implements IOwner { 9 | 10 | private Long id; 11 | private String name; 12 | private int age; 13 | 14 | Owner() { 15 | } 16 | 17 | @Creator 18 | public Owner(Long id, String name, int age) { 19 | this.id = id; 20 | this.name = name; 21 | this.age = age; 22 | } 23 | 24 | @Override 25 | public Long getId() { 26 | return id; 27 | } 28 | 29 | public void setId(Long id) { 30 | this.id = id; 31 | } 32 | 33 | @Override 34 | public String getName() { 35 | return name; 36 | } 37 | 38 | @Override 39 | public void setName(String name) { 40 | this.name = name; 41 | } 42 | 43 | @Override 44 | public int getAge() { 45 | return age; 46 | } 47 | 48 | @Override 49 | public void setAge(int age) { 50 | this.age = age; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /tests/jooq-tests/jooq-jdbc-postgres/src/main/java/example/jooq/sync/Pet.java: -------------------------------------------------------------------------------- 1 | package example.jooq.sync; 2 | 3 | import example.domain.IOwner; 4 | import example.domain.IPet; 5 | import io.micronaut.core.annotation.Creator; 6 | import io.micronaut.core.annotation.Nullable; 7 | import io.micronaut.serde.annotation.Serdeable; 8 | 9 | @Serdeable 10 | public class Pet implements IPet { 11 | 12 | private Long id; 13 | private String name; 14 | private PetType type; 15 | private Owner owner; 16 | 17 | Pet() { 18 | } 19 | 20 | @Creator 21 | public Pet(Long id, String name, @Nullable PetType type, Owner owner) { 22 | this.id = id; 23 | this.name = name; 24 | this.type = type; 25 | this.owner = owner; 26 | } 27 | 28 | @Override 29 | public Long getId() { 30 | return id; 31 | } 32 | 33 | @Override 34 | public void setId(Long id) { 35 | this.id = id; 36 | } 37 | 38 | @Override 39 | public String getName() { 40 | return name; 41 | } 42 | 43 | @Override 44 | public void setName(String name) { 45 | this.name = name; 46 | } 47 | 48 | @Override 49 | public Owner getOwner() { 50 | return owner; 51 | } 52 | 53 | @Override 54 | public void setOwner(IOwner owner) { 55 | this.owner = (Owner) owner; 56 | } 57 | 58 | @Override 59 | public PetType getType() { 60 | return type; 61 | } 62 | 63 | @Override 64 | public void setType(PetType type) { 65 | this.type = type; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /tests/jooq-tests/jooq-jdbc-postgres/src/test/java/example/jooq/sync/PostgresApp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package example.jooq.sync; 17 | 18 | import example.sync.AbstractApp; 19 | import io.micronaut.context.annotation.Property; 20 | import io.micronaut.test.extensions.junit5.annotation.MicronautTest; 21 | 22 | @MicronautTest 23 | @Property(name = "datasources.default.db-type", value = "postgres") 24 | @Property(name = "jooq.datasources.default.sql-dialect", value = "postgres") 25 | public class PostgresApp extends AbstractApp { 26 | } 27 | 28 | -------------------------------------------------------------------------------- /tests/jooq-tests/jooq-jdbc-postgres/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /tests/jooq-tests/jooq-r2dbc-postgres/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'io.micronaut.build.internal.test-application' 3 | } 4 | 5 | dependencies { 6 | implementation projects.micronautJooq 7 | implementation mnData.micronaut.data.tx 8 | implementation mnData.micronaut.data.r2dbc 9 | implementation mnR2dbc.r2dbc.postgresql 10 | implementation mnR2dbc.r2dbc.pool 11 | 12 | implementation projects.micronautTests.micronautCommonReactive 13 | 14 | testImplementation projects.micronautTests.micronautCommonTests 15 | } 16 | 17 | micronaut { 18 | testResources { 19 | additionalModules.add(R2DBC_POSTGRESQL) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/jooq-tests/jooq-r2dbc-postgres/src/main/java/example/jooq/reactive/Owner.java: -------------------------------------------------------------------------------- 1 | package example.jooq.reactive; 2 | 3 | import example.domain.IOwner; 4 | import io.micronaut.serde.annotation.Serdeable; 5 | 6 | @Serdeable 7 | public class Owner implements IOwner { 8 | 9 | private Long id; 10 | private String name; 11 | private int age; 12 | 13 | Owner() { 14 | } 15 | 16 | public Owner(Long id, String name, int age) { 17 | this.id = id; 18 | this.name = name; 19 | this.age = age; 20 | } 21 | 22 | @Override 23 | public Long getId() { 24 | return id; 25 | } 26 | 27 | public void setId(Long id) { 28 | this.id = id; 29 | } 30 | 31 | @Override 32 | public String getName() { 33 | return name; 34 | } 35 | 36 | @Override 37 | public void setName(String name) { 38 | this.name = name; 39 | } 40 | 41 | @Override 42 | public int getAge() { 43 | return age; 44 | } 45 | 46 | @Override 47 | public void setAge(int age) { 48 | this.age = age; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /tests/jooq-tests/jooq-r2dbc-postgres/src/main/java/example/jooq/reactive/Pet.java: -------------------------------------------------------------------------------- 1 | package example.jooq.reactive; 2 | 3 | import example.domain.IOwner; 4 | import example.domain.IPet; 5 | import io.micronaut.core.annotation.Nullable; 6 | import io.micronaut.serde.annotation.Serdeable; 7 | 8 | @Serdeable 9 | public class Pet implements IPet { 10 | 11 | private Long id; 12 | private String name; 13 | private PetType type; 14 | private Owner owner; 15 | 16 | Pet() { 17 | } 18 | 19 | public Pet(Long id, String name, @Nullable PetType type, Owner owner) { 20 | this.id = id; 21 | this.name = name; 22 | this.type = type; 23 | this.owner = owner; 24 | } 25 | 26 | @Override 27 | public Long getId() { 28 | return id; 29 | } 30 | 31 | @Override 32 | public void setId(Long id) { 33 | this.id = id; 34 | } 35 | 36 | @Override 37 | public String getName() { 38 | return name; 39 | } 40 | 41 | @Override 42 | public void setName(String name) { 43 | this.name = name; 44 | } 45 | 46 | @Override 47 | public Owner getOwner() { 48 | return owner; 49 | } 50 | 51 | @Override 52 | public void setOwner(IOwner owner) { 53 | this.owner = (Owner) owner; 54 | } 55 | 56 | @Override 57 | public PetType getType() { 58 | return type; 59 | } 60 | 61 | @Override 62 | public void setType(PetType type) { 63 | this.type = type; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /tests/jooq-tests/jooq-r2dbc-postgres/src/test/java/example/jooq/reactive/PostgresApp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package example.jooq.reactive; 17 | 18 | import example.sync.AbstractApp; 19 | import io.micronaut.context.annotation.Property; 20 | import io.micronaut.test.extensions.junit5.annotation.MicronautTest; 21 | 22 | @MicronautTest(transactional = false) 23 | @Property(name = "r2dbc.datasources.default.db-type", value = "postgres") 24 | @Property(name = "jooq.r2dbc-datasources.default.sql-dialect", value = "postgres") 25 | @Property(name = "r2dbc.datasources.default.options.driver", value = "pool") 26 | @Property(name = "r2dbc.datasources.default.options.protocol", value = "postgresql") 27 | @Property(name = "r2dbc.datasources.default.options.connectTimeout", value = "PT1M") 28 | @Property(name = "r2dbc.datasources.default.options.statementTimeout", value = "PT1M") 29 | @Property(name = "r2dbc.datasources.default.options.lockTimeout", value = "PT1M") 30 | public class PostgresApp extends AbstractApp { 31 | } 32 | -------------------------------------------------------------------------------- /tests/jooq-tests/jooq-r2dbc-postgres/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /vertx-mysql-client/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'io.micronaut.build.internal.sql-module' 3 | } 4 | 5 | dependencies { 6 | api(mn.micronaut.inject) 7 | api(libs.managed.vertx.mysql.client) 8 | api(libs.managed.vertx.rx.java2) 9 | 10 | implementation(libs.managed.vertx.codegen) 11 | 12 | compileOnly(mn.micronaut.management) 13 | 14 | testImplementation(mn.micronaut.management) 15 | testImplementation(mnTestResources.testcontainers.mysql) 16 | testImplementation(libs.managed.mysql.connector.j) 17 | } 18 | -------------------------------------------------------------------------------- /vertx-mysql-client/src/main/java/io/micronaut/configuration/vertx/mysql/client/MySQLClientSettings.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.micronaut.configuration.vertx.mysql.client; 17 | 18 | /** 19 | * The client settings. 20 | */ 21 | public interface MySQLClientSettings { 22 | /** 23 | * The prefix to use for all Vertx MySQL Client ConnectOptions settings. 24 | */ 25 | String PREFIX = "vertx.mysql.client"; 26 | } 27 | -------------------------------------------------------------------------------- /vertx-mysql-client/src/main/java/io/micronaut/configuration/vertx/mysql/client/condition/RequiresVertxMySQLClient.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.micronaut.configuration.vertx.mysql.client.condition; 17 | 18 | import io.micronaut.configuration.vertx.mysql.client.MySQLClientSettings; 19 | import io.micronaut.context.annotation.Requires; 20 | import io.vertx.mysqlclient.MySQLConnectOptions; 21 | import io.vertx.sqlclient.PoolOptions; 22 | 23 | import java.lang.annotation.*; 24 | 25 | /** 26 | * Custom condition to indicate bean requires the vertx mysql client. 27 | */ 28 | @Documented 29 | @Retention(RetentionPolicy.RUNTIME) 30 | @Target({ElementType.PACKAGE, ElementType.TYPE}) 31 | @Requires(property = MySQLClientSettings.PREFIX) 32 | @Requires(classes = {MySQLConnectOptions.class, PoolOptions.class}) 33 | public @interface RequiresVertxMySQLClient { 34 | } 35 | -------------------------------------------------------------------------------- /vertx-mysql-client/src/main/java/io/micronaut/configuration/vertx/mysql/client/health/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Health checking classes. 18 | */ 19 | package io.micronaut.configuration.vertx.mysql.client.health; 20 | -------------------------------------------------------------------------------- /vertx-mysql-client/src/main/java/io/micronaut/configuration/vertx/mysql/client/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Vertx MySQL Client MySQLConnectionConfiguration classes. 18 | * 19 | * @author puneetbehl 20 | * @since 1.0 21 | */ 22 | @Configuration 23 | @RequiresVertxMySQLClient 24 | package io.micronaut.configuration.vertx.mysql.client; 25 | 26 | import io.micronaut.configuration.vertx.mysql.client.condition.RequiresVertxMySQLClient; 27 | import io.micronaut.context.annotation.Configuration; 28 | -------------------------------------------------------------------------------- /vertx-mysql-client/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /vertx-pg-client/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'io.micronaut.build.internal.sql-module' 3 | } 4 | 5 | dependencies { 6 | api(mn.micronaut.inject) 7 | api(libs.managed.vertx.pg.client) 8 | api(libs.managed.vertx.rx.java2) 9 | 10 | implementation(libs.managed.vertx.codegen) 11 | 12 | compileOnly(mn.micronaut.management) 13 | runtimeOnly libs.managed.ongres.scram.client 14 | 15 | testImplementation(mn.micronaut.management) 16 | testImplementation(mnTestResources.testcontainers.postgres) 17 | } 18 | -------------------------------------------------------------------------------- /vertx-pg-client/src/main/java/io/micronaut/configuration/vertx/pg/client/PgClientSettings.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.micronaut.configuration.vertx.pg.client; 17 | 18 | /** 19 | * The PgClient settings. 20 | */ 21 | public interface PgClientSettings { 22 | /** 23 | * The prefix to use for all Vertx Pg Client ConnectOptions settings. 24 | */ 25 | String PREFIX = "vertx.pg.client"; 26 | } 27 | -------------------------------------------------------------------------------- /vertx-pg-client/src/main/java/io/micronaut/configuration/vertx/pg/client/condition/RequiresVertxPgClient.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.micronaut.configuration.vertx.pg.client.condition; 17 | 18 | import io.micronaut.configuration.vertx.pg.client.PgClientSettings; 19 | import io.micronaut.context.annotation.Requires; 20 | import io.vertx.pgclient.PgConnectOptions; 21 | import io.vertx.sqlclient.PoolOptions; 22 | 23 | import java.lang.annotation.*; 24 | 25 | /** 26 | * Custom condition to indicate a bean requires the vertx pg client. 27 | */ 28 | @Documented 29 | @Retention(RetentionPolicy.RUNTIME) 30 | @Target({ElementType.PACKAGE, ElementType.TYPE}) 31 | @Requires(property = PgClientSettings.PREFIX) 32 | @Requires(classes = {PgConnectOptions.class, PoolOptions.class}) 33 | public @interface RequiresVertxPgClient { 34 | } 35 | -------------------------------------------------------------------------------- /vertx-pg-client/src/main/java/io/micronaut/configuration/vertx/pg/client/health/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * PgClient health checking. 18 | */ 19 | package io.micronaut.configuration.vertx.pg.client.health; 20 | -------------------------------------------------------------------------------- /vertx-pg-client/src/main/java/io/micronaut/configuration/vertx/pg/client/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2020 original authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Vertx Pg Client PgConnectionConfiguration classes. 18 | * 19 | */ 20 | @Configuration 21 | @RequiresVertxPgClient 22 | package io.micronaut.configuration.vertx.pg.client; 23 | 24 | import io.micronaut.configuration.vertx.pg.client.condition.RequiresVertxPgClient; 25 | import io.micronaut.context.annotation.Configuration; 26 | 27 | -------------------------------------------------------------------------------- /vertx-pg-client/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | --------------------------------------------------------------------------------