Add SQLITE Dialect#3830
Conversation
This change adds a new entry to `Capability`. BATCH_INSERT. It also modifies the API of `ConnectionCapablities`, adding the method `public boolean supports(ConnectionCapabilities.Capability capability, Supplier<String> databaseProductNameSupplier)`. So that the API can be invoked with a `java.sql.Connection` or a `io.r2dbc.spi.Connection`. This change modifies the `DefaultConnectionCapabilities` implementation to specify that SQL Server does not support BATCH_INSERT. This business logic was already specified in `AbstractSqlRepositoryOperations::isSupportBatchIsert(PersistentEntity, Dialect)`. SQLite does not support batch inserts either. This change modifies `SqliteConnectionCapabilities` to specify that and adds a test which verifies that with the new Capability check, a `saveAll` method invocation is possible with SQLite.
…faultR2dbcRepositoryOperations.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…yTest.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…rivate Agent-Logs-Url: https://github.com/micronaut-projects/micronaut-data/sessions/00ad2232-317f-4181-bb07-7c1afd70e3f5 Co-authored-by: sdelamo <864788+sdelamo@users.noreply.github.com>
…yTest.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…nCapabilities.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…aultConnectionCapabilities.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ract and R2DBC support Agent-Logs-Url: https://github.com/micronaut-projects/micronaut-data/sessions/a230870b-d7db-4c4a-aa5a-b953944a12f2 Co-authored-by: sdelamo <864788+sdelamo@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds first-class SQLite support across Micronaut Data by introducing a Dialect.SQLITE, updating SQL/runtime infrastructure to accommodate SQLite-specific behavior, and adding a dedicated JDBC SQLite test suite plus documentation and example updates.
Changes:
- Added
Dialect.SQLITEplus SQLite-oriented SQL generation tweaks (e.g.,DEFAULT VALUES, identity/INTEGER handling, batch rules). - Introduced a new
test-suite-data-jdbc-sqlitemodule with extensive coverage for repositories, joins, multitenancy, generated values, etc. - Updated
ConnectionCapabilitiesAPI to be supplier-based (usable for JDBC + R2DBC) and refreshed docs/examples accordingly.
Reviewed changes
Copilot reviewed 239 out of 250 changed files in this pull request and generated 15 comments.
Show a summary per file
| File | Description |
|---|---|
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/one2one/select/MyOrder.java | Adds SQLite test entity for one-to-one select scenario |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/one2one/select/MyEmbedded.java | Adds SQLite embedded entity used in one-to-one tests |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/one2many/OneToManyJoinColumnTest.java | Adds SQLite join-column one-to-many save/load test |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/multitenancy/TenancyPersonService.java | Adds SQLite multitenancy service wrapper used by tests |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/multitenancy/TenancyPersonRepository.java | Adds SQLite multitenancy repository with custom INSERT queries |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/multitenancy/TenancyPerson.java | Adds SQLite multitenancy record entity (tenant id) |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/multitenancy/TenancyBookRepository.java | Adds SQLite multitenancy repository for book controller spec |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/multitenancy/TenancyBookController.java | Adds example controller used in multitenancy tests |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/multitenancy/TenancyBook.java | Adds SQLite multitenancy book entity |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/joinissue/Movie.java | Adds join-issue coverage entity for SQLite |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/joinissue/DirectorTest.java | Adds join fetch test coverage for Director/Movie |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/joinissue/DirectorRepository.java | Adds SQLite repository for join fetch tests |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/joinissue/Director.java | Adds Director entity for join issue test coverage |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/joinissue/Book.java | Adds Book entity for Author/Book join issue testing |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/joinissue/AuthorTest.java | Adds SQLite tests for join behavior on Author/Book |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/joinissue/AuthorRepository.java | Adds SQLite repository with custom query for join issue reproduction |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/joinissue/Author.java | Adds Author entity for join tests |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/jakarta_data/utilities/TestPropertyHandler.java | Adds Jakarta Data TCK helper for loading cached properties |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/jakarta_data/utilities/DatabaseType.java | Adds Jakarta Data utility enum used by tests |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/jakarta_data/simple/CustomerRepository2.java | Adds Jakarta Data repository variant for SQLite |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/jakarta_data/simple/CustomerRepository.java | Adds Jakarta Data repository for basic CRUD on SQLite |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/jakarta_data/simple/CustomerOnlyDeleteQueryRepository.java | Adds Jakarta Data delete-only repository for SQLite |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/jakarta_data/simple/Customer.java | Adds Jakarta Data customer entity for SQLite |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/jakarta_data/simple/Address.java | Adds embeddable Address record used by Customer |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/jakarta_data/read/only/_AsciiCharacter.java | Adds static metamodel test fixture (annotation-processor style) |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/jakarta_data/read/only/_AsciiChar.java | Adds static metamodel test fixture (user-defined style) |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/jakarta_data/read/only/ReadOnlyRepository.java | Adds experimental read-only repository abstraction (deprecated) |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/jakarta_data/read/only/PositiveIntegers.java | Adds read-only repository to run Jakarta Data queries on SQLite |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/jakarta_data/read/only/Populator.java | Adds helper interface to pre-populate read-only repos |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/jakarta_data/read/only/NaturalNumbersPopulator.java | Adds populator implementation for NaturalNumbers |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/jakarta_data/read/only/NaturalNumbers.java | Adds NaturalNumbers repository interface for read-only testing |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/jakarta_data/read/only/NaturalNumber.java | Adds NaturalNumber entity used by read-only repositories |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/jakarta_data/read/only/IdOperations.java | Adds shared operations used by read-only repositories |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/jakarta_data/read/only/CustomRepository.java | Adds custom repository to test entity inference rules |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/jakarta_data/read/only/AsciiCharactersPopulator.java | Adds populator for AsciiCharacters repo |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/jakarta_data/read/only/AsciiCharacter.java | Adds AsciiCharacter entity used by read-only tests |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/jakarta_data/entity/MultipleEntityRepo.java | Adds repository operating on multiple entity types (Jakarta Data) |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/jakarta_data/entity/Coordinate.java | Adds entity containing UUID/double/float coverage |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/jakarta_data/entity/Boxes.java | Adds BasicRepository-only repository for Box entity |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/jakarta_data/entity/Box.java | Adds Box entity used by repository tests |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/identity/SameIdentityRepositoryTest.java | Adds regression tests for same-identity result mapping |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/identity/MyBookRepository.java | Adds repository returning repeated IDs / DTO mapping coverage |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/identity/MyBookDto2.java | Adds DTO record for renamed ID mapping |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/identity/MyBookDto.java | Adds DTO record mapping id/title |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/identity/MyBook.java | Adds entity for identity mapping tests |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/groovy_static_repo/TestEntityRepository.java | Adds repository to validate Groovy static repo behavior on SQLite |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/groovy_static_repo/SQLiteGroovyStaticExtendedRepositoryTest.java | Adds test for Groovy static repo extension on SQLite |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/groovy_static_repo/MyCrudRepository.java | Adds generic custom CRUD extension for Groovy test |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/groovy_static_repo/GTestEntity.java | Adds Groovy test entity |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/autopopulate/package-info.java | Adds package docs for autopopulate test coverage |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/autopopulate/InnerFields.java | Adds embeddable with autopopulated fields test coverage |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/TableRatings.java | Adds entity with escaped table/column names for SQLite |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SqliteUuidRepository.java | Adds UUID mapping repository coverage for SQLite |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SqliteUuidEntity.java | Adds UUID entity with nullable UUID column mapping |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SqliteUUIDTest.java | Adds tests for UUID persistence, update, null handling |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SqliteSchemaValidationTest.java | Adds disabled schema validation tests for SQLite |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SqliteGeneratedValueTest.java | Adds tests verifying generated identity handling on SQLite |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SqliteGeneratedValueRepository.java | Adds repository for generated-value entity tests |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SqliteGeneratedValueEntity.java | Adds entity with @GeneratedValue for SQLite |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SqliteConnectionCapabilities.java | Adds SQLite-specific ConnectionCapabilities implementation for tests |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/ShipmentRepository.java | Adds SQLite pageable repository wrapper for Shipment |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteWhereAnnotationTest.java | Adds test coverage for @Where with SQLite dialect |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteUserRoleRepository.java | Adds SQLite repository wrapper for TCK UserRole repository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteUserRepository.java | Adds SQLite repository wrapper for TCK User repository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteUnidirectionalToManyJoinTest.java | Adds unidirectional to-many join test for SQLite |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteTrainsRepository.java | Adds SQLite wrapper for TrainsRepository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteTrainRepository.java | Adds SQLite wrapper for TrainRepository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteTimezoneBasicTypesRepository.java | Adds SQLite wrapper for timezone repository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteTestingPropertyProvider.java | Adds shared test property provider for SQLite datasources |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteTaskRepository.java | Adds SQLite wrapper for Task repository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteTaskGenericEntityRepository.java | Adds SQLite wrapper for TaskGenericEntity repository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteTaskGenericEntity2Repository.java | Adds SQLite wrapper for TaskGenericEntity2 repository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteTableRatingsRepository.java | Adds SQLite repository for escaped table/column mapping tests |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteStudentRepository.java | Adds SQLite wrapper for StudentRepository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteStudentReactiveRepository.java | Adds SQLite wrapper for reactive student repository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteStreamingStatementTest.java | Adds streaming statement/ordering test coverage for SQLite |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteShelfRepository.java | Adds SQLite wrapper for ShelfRepository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteShelfBookRepository.java | Adds SQLite wrapper for ShelfBookRepository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteSchemaGenerationTest.java | Adds disabled schema-generation UUID test note for SQLite |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteSchemaCreateDropTest.java | Adds integration test for CREATE_DROP with SQLite |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteSaleRepository.java | Adds SQLite wrapper for SaleRepository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteSaleItemRepository.java | Adds SQLite wrapper for SaleItemRepository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteRoleRepository.java | Adds SQLite wrapper for RoleRepository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteRestaurantRepository.java | Adds SQLite wrapper w/ embedded-property query for Restaurant |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteRepositoryBehaviorTest.java | Adds SQLite-specific behavior test extension |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteRegionRepository.java | Adds SQLite wrapper for RegionRepository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteReactiveRepositoryTest.java | Adds reactive repository TCK runner configuration for SQLite |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteReactivePersonRepository.java | Adds SQLite wrapper for reactive person repository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteReactiveBookRepository.java | Adds SQLite wrapper for reactive book repository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteProjectRepository.java | Adds SQLite wrapper with composite-id update override |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteProductDtoRepository.java | Adds SQLite wrapper for ProductDtoRepository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLitePlantRepository.java | Adds SQLite wrapper for PlantRepository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLitePatientRepository.java | Adds SQLite override for JSON update query |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLitePageRepository.java | Adds SQLite wrapper for PageRepository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteOrganizationRepository.java | Adds SQLite wrapper for OrganizationRepository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteOrderTest.java | Adds case-insensitive ordering test for SQLite |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteNullableConstructorTest.java | Adds nullable association constructor test for SQLite |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteNoseRepository.java | Adds SQLite wrapper for NoseRepository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteNoTxOpsRepositoryTest.java | Adds configuration variant disabling tx-per-operation |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteNoTxOpsRepositoryBehaviorTest.java | Adds behavior test variant for no-tx configuration |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteNoIdEntityRepositoryTest.java | Adds test ensuring repository works with unconventional ID mapping |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteNoIdEntityRepository.java | Adds repository for NoIdEntity test |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteMealRepository.java | Adds SQLite wrapper combining validation + CRUD generics |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteMappedEntityTest.java | Adds mapped-entity/multiple-interface regression test |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteJsonEntityRepository.java | Adds SQLite override for JSON update query |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteJakartaDataTest.java | Adds Jakarta Data TCK runner tweaks/disabled cases for SQLite |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteIntervalRepository.java | Adds SQLite wrapper for IntervalRepository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteHouseEntityRepository.java | Adds SQLite wrapper for embedded-house repository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteGenreRepository.java | Adds SQLite wrapper for Genre repository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteFoodRepository.java | Adds SQLite wrapper for Food repository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteFaceRepository.java | Adds SQLite wrapper for Face repository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteExampleEntityRepository.java | Adds SQLite wrapper for ExampleEntityRepository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteEntityWithIdClassRepository.java | Adds SQLite wrapper for IdClass repository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteEntityWithIdClass2Repository.java | Adds SQLite wrapper for IdClass2 repository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteEnabledPersonRepository.java | Adds SQLite repository using @Where to enforce enabled filter |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteEmbeddedTest.java | Adds embedded-entity persistence/query tests for SQLite |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteEagerContextTest.java | Adds eager-init + schema generator behavior test for SQLite |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteDoubleImplement3Repository.java | Adds SQLite wrapper for multiple-interface repository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteDoubleImplement2Repository.java | Adds SQLite wrapper for multiple-interface repository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteDoubleImplement1Repository.java | Adds SQLite wrapper for multiple-interface repository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteDomainEventsRepository.java | Adds SQLite wrapper for domain events repository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteDomainEventsReactiveRepository.java | Adds SQLite wrapper for reactive domain events repository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteDisabledDataSourceTest.java | Adds test verifying disabled datasource behavior on SQLite |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteDBPropertiesTestPropertyProviderFactory.java | Adds annotation-driven test property provider factory |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteDBProperties.java | Adds annotation encapsulating SQLite datasource defaults |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteCustomIdTest.java | Adds tests for custom IDs on SQLite repositories |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteCountryRepository.java | Adds SQLite wrapper for CountryRepository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteCountryRegionCityRepository.java | Adds SQLite wrapper for CountryRegionCityRepository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteCompositePrimaryKeyTest.java | Adds composite primary key CRUD test coverage |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteCompanyRepository.java | Adds SQLite wrapper for CompanyRepository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteCityRepository.java | Adds SQLite wrapper for CityRepository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteCascadeTest.java | Adds cascade persistence regression test for SQLite |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteCarRepository.java | Adds SQLite wrapper for CarRepository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteBookService.java | Adds service demonstrating manual join/entity mapping via JdbcOperations |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteBookRepository.java | Adds SQLite BookRepository implementation and custom queries |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteBookPageRepository.java | Adds SQLite wrapper for BookPageRepository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteBookEntityRepository.java | Adds SQLite wrapper for embedded BookEntityRepository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteBookDtoRepository.java | Adds SQLite wrapper for BookDtoRepository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteBasicTypesTest.java | Adds basic type mapping tests for SQLite |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteBasicTypesRepository.java | Adds SQLite wrapper for BasicTypesRepository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteAuthorRepository.java | Adds SQLite AuthorRepository with custom mapping examples |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteAsyncRepositoryTest.java | Adds async repository TCK runner for SQLite |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteAsyncPersonRepository.java | Adds SQLite wrapper for async person repository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteAsyncBookRepository.java | Adds SQLite wrapper for async book repository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteArraysTest.java | Adds disabled test documenting SQLite lack of ARRAY support |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteArraysEntityRepository.java | Adds SQLite wrapper for ArraysEntityRepository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteAccountRepository.java | Adds SQLite wrapper for AccountRepository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/SQLiteAccountRecordRepository.java | Adds SQLite wrapper for AccountRecordRepository |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/OrganizationRepository.java | Adds base OrganizationRepository interface used by SQLite wrapper |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/NoIdEntity.java | Adds entity w/ nonstandard id field naming for tests |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/LocalDateTimeTest.java | Adds ZonedDateTime/LocalDateTime test coverage on SQLite |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/JpaTransientPropertyTest.java | Adds criteria/spec test ensuring transient property handling |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/ChallengeRepositoryTest.java | Adds regression test for multiple joins query |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/ChallengeRepository.java | Adds repository override for multi-join fetch graph |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/CascadeSubEntityB.java | Adds cascade child entity B for SQLite cascade tests |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/CascadeSubEntityA.java | Adds cascade child entity A for SQLite cascade tests |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/CascadeEntityRepository.java | Adds repository for cascade entity graph loading |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/sqlite/CascadeEntity.java | Adds cascade root entity for save/load graph testing |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/SchemaCreateDropTest.java | Adds shared abstract schema create/drop test scaffold |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/CallableStatementTupleMapperTest.java | Adds tuple mapper unit test (callable statement) |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/AbstractJdbcTransactionTest.java | Adds JDBC transaction test base for SQLite suite |
| test-suite-data-jdbc-sqlite/src/test/java/io/micronaut/data/jdbc/AbstractJdbcMultitenancyTest.java | Adds JDBC multitenancy test base for SQLite suite |
| test-suite-data-jdbc-sqlite/build.gradle.kts | Adds build for new SQLite JDBC test-suite module |
| src/main/docs/guide/dbc/jdbc/jdbcConfiguration.adoc | Documents Dialect.SQLITE and required dependency |
| settings.gradle | Includes new test-suite-data-jdbc-sqlite module |
| doc-examples/jdbc-sqlite/src/test/java/example/SqliteConnectionCapabilitiesTest.java | Adds example tests for SQLite connection capabilities behavior |
| doc-examples/jdbc-sqlite/src/test/java/example/PersonRepositoryTest.java | Adds example test for SQLite batch insert |
| doc-examples/jdbc-sqlite/src/test/java/example/BookRepositoryTest.java | Updates example test to rely on SQLite dialect/schema generation |
| doc-examples/jdbc-sqlite/src/main/java/example/SqliteConnectionCapabilities.java | Updates example capabilities impl to supplier-based API |
| doc-examples/jdbc-sqlite/src/main/java/example/PersonRepository.java | Adds book/person SQLite repo using Dialect.SQLITE |
| doc-examples/jdbc-sqlite/src/main/java/example/Person.java | Adds example Person record entity |
| doc-examples/jdbc-sqlite/src/main/java/example/BookRepository.java | Updates example book repo to Dialect.SQLITE |
| doc-examples/jdbc-sqlite/build.gradle | Adds junit-jupiter-params for new parameterized tests |
| data-runtime/src/main/java/io/micronaut/data/runtime/operations/internal/sql/AbstractSqlRepositoryOperations.java | Alters batch-insert support decision logic (uses allowBatch) |
| data-runtime/src/main/java/io/micronaut/data/runtime/operations/internal/SyncCascadeOperations.java | Fixes cascade persist logic for to-many associations |
| data-runtime/src/main/java/io/micronaut/data/runtime/operations/internal/ReactiveCascadeOperations.java | Mirrors cascade persist logic fix for reactive path |
| data-runtime/src/main/java/io/micronaut/data/runtime/operations/internal/AbstractCascadeOperations.java | Adds shared helper to decide persistability + aligns batch veto logic |
| data-r2dbc/src/main/java/io/micronaut/data/r2dbc/operations/DefaultR2dbcRepositoryOperations.java | Preps R2DBC ops for ConnectionCapabilities usage |
| data-r2dbc/build.gradle | Adds junit-jupiter-params for tests |
| data-model/src/main/java/io/micronaut/data/model/schema/sql/SqlColumnMapping.java | Adjusts SQL type mapping for SQLite identity semantics |
| data-model/src/main/java/io/micronaut/data/model/query/builder/sql/SqlQueryBuilder.java | Adds DEFAULT VALUES insert generation when no columns present |
| data-model/src/main/java/io/micronaut/data/model/query/builder/sql/Dialect.java | Introduces SQLITE dialect + supportsReadOnly flag |
| data-model/build.gradle | Adds Micronaut JUnit support to data-model tests |
| data-jdbc/src/main/java/io/micronaut/data/jdbc/operations/DefaultJdbcRepositoryOperations.java | Preps JDBC ops for ConnectionCapabilities usage |
| data-connection/src/test/java/io/micronaut/data/connection/DefaultConnectionCapabilitiesTest.java | Adds test coverage for DefaultConnectionCapabilities |
| data-connection/src/test/java/example/CustomConnectionCapabilities.java | Updates example capabilities impl to supplier-based signature |
| data-connection/src/main/java/io/micronaut/data/connection/DefaultConnectionCapabilities.java | Updates default impl to supplier-based signature |
| data-connection/src/main/java/io/micronaut/data/connection/ConnectionCapabilities.java | Updates API to supplier-based + adds JDBC overload default impl |
| data-connection/build.gradle | Adds junit-jupiter-params for parameterized tests |
| return () -> Map.of( | ||
| "datasources.default.name", sqliteDbProperties.name(), | ||
| "datasources.default.packages", sqliteDbProperties.packages(), | ||
| "datasources.default.schema-generate", sqliteDbProperties.schemaGenerate(), | ||
| "datasources.default.dialect", sqliteDbProperties.dialect(), | ||
| "datasources.default.db-type", sqliteDbProperties.dbType(), | ||
| "datasources.default.driverClassName", sqliteDbProperties.driverClassName(), | ||
| "datasources.default.url", sqliteDbProperties.url(), | ||
| "datasources.default.username", sqliteDbProperties.username(), | ||
| "datasources.default.password", sqliteDbProperties.password() | ||
| ); |
There was a problem hiding this comment.
The default SQLiteDBProperties#url() contains a %s placeholder, but the factory passes it through unformatted. This will produce an invalid JDBC URL like jdbc:sqlite:file:%s?.... Format the URL (e.g., with the annotation's name() or another unique value) before returning it.
| WHERE (`name` LIKE CONCAT('%',:partialName,'%')) | ||
| LIMIT 1) author_ | ||
| LEFT JOIN book author_books_ ON author_.id=author_books_.author; | ||
| */ | ||
| @Query("SELECT author_.`id`,author_.`name`,author_books_.`id` AS books_id,author_books_.`title` AS books_title,author_books_.`author` AS books_author FROM (SELECT id,name FROM ji_author WHERE (`name` LIKE CONCAT('%',:partialName,'%')) LIMIT 1) author_ LEFT JOIN ji_book author_books_ ON author_.id=author_books_.author;") |
There was a problem hiding this comment.
SQLite doesn't support CONCAT(...) by default. This query will fail on SQLite; use SQLite-compatible concatenation (e.g., '%' || :partialName || '%'). Also consider dropping the trailing ; in the SQL string to avoid driver-specific parsing issues.
| WHERE (`name` LIKE CONCAT('%',:partialName,'%')) | |
| LIMIT 1) author_ | |
| LEFT JOIN book author_books_ ON author_.id=author_books_.author; | |
| */ | |
| @Query("SELECT author_.`id`,author_.`name`,author_books_.`id` AS books_id,author_books_.`title` AS books_title,author_books_.`author` AS books_author FROM (SELECT id,name FROM ji_author WHERE (`name` LIKE CONCAT('%',:partialName,'%')) LIMIT 1) author_ LEFT JOIN ji_book author_books_ ON author_.id=author_books_.author;") | |
| WHERE (`name` LIKE ('%' || :partialName || '%')) | |
| LIMIT 1) author_ | |
| LEFT JOIN book author_books_ ON author_.id=author_books_.author | |
| */ | |
| @Query("SELECT author_.`id`,author_.`name`,author_books_.`id` AS books_id,author_books_.`title` AS books_title,author_books_.`author` AS books_author FROM (SELECT id,name FROM ji_author WHERE (`name` LIKE ('%' || :partialName || '%')) LIMIT 1) author_ LEFT JOIN ji_book author_books_ ON author_.id=author_books_.author") |
| import org.junit.jupiter.api.Test; | ||
| import org.junit.jupiter.api.condition.DisabledInNativeImage; | ||
| import org.junit.jupiter.params.ParameterizedTest; | ||
| import org.junit.jupiter.params.provider.CsvSource; |
There was a problem hiding this comment.
This test contains unused imports (CsvSource, assertEquals) and an unused helper (connectionThrowingMetadataException). Either remove the dead code or add a test that uses connectionThrowingMetadataException() to cover the fallback behavior when metadata lookup fails.
|
|
||
| @Override | ||
| public void populationLogic(NaturalNumbers repo) { | ||
| List<NaturalNumber> dictonary = new ArrayList<>(); |
There was a problem hiding this comment.
The variable name dictonary is misspelled and reduces readability. Rename it to dictionary (or numbers) consistently.
| dictonary.add(inst); | ||
| }); | ||
|
|
||
| repo.saveAll(dictonary); |
There was a problem hiding this comment.
The variable name dictonary is misspelled and reduces readability. Rename it to dictionary (or numbers) consistently.
| boolean existsByIdGreaterThan(Long number); | ||
|
|
||
| CursoredPage<NaturalNumber> findByFloorOfSquareRootNotAndIdLessThanOrderByNumBitsRequiredDesc(long excludeSqrt, | ||
| long eclusiveMax, |
There was a problem hiding this comment.
Parameter name eclusiveMax is misspelled; rename it to exclusiveMax to match the method semantics and avoid confusion.
| long eclusiveMax, | |
| long exclusiveMax, |
| yield "NUMBER(19)"; | ||
|
|
||
| // In SQLite, INTEGER PRIMARY KEY has special behavior (rowid, auto-generation). | ||
| } else if (dialect == Dialect.SQLITE && isAutoGenerated()) { |
There was a problem hiding this comment.
For such a table:
record Person(@Id @GeneratedValue @Nullable Long id, String name, int age) {}for SQLite the following table should be created:
CREATE TABLE "person" ("id" INTEGER PRIMARY KEY,"name" VARCHAR(255) NOT NULL,"age" INT NOT NULL);BIG PRIMARY KEY does not work for primary key auto generation.
…faultR2dbcRepositoryOperations.java
…ultJdbcRepositoryOperations.java
…bc/sqlite/jakarta_data/utilities/TestPropertyHandler.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…yTest.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 238 out of 247 changed files in this pull request and generated 6 comments.
Comments suppressed due to low confidence (1)
doc-examples/jdbc-sqlite/src/test/java/example/SqliteConnectionCapabilitiesTest.java:1
- These imports appear unused in the test and will fail compilation (unused imports are compilation errors in Java). Remove the unused imports or adjust assertions/logic to use them.
package example;
| * {@link RuntimeException} if the metadata cannot be retrieved | ||
| * @return {@code true} if the connection supports the capability; {@code false} otherwise | ||
| */ | ||
| boolean supports(Capability capability, Supplier<String> databaseProductNameSupplier); |
There was a problem hiding this comment.
Changing the SPI contract from supports(Capability, Connection) to supports(Capability, Supplier<String>) is a source/binary breaking change for any external ConnectionCapabilities implementations loaded via Java SPI. To preserve compatibility, consider keeping the original supports(Capability, Connection) as the primary method (or at least as an abstract method) and adding the supplier-based method as a default method (e.g., defaulting to true), then migrate internal call sites to prefer the supplier overload. That way existing third-party implementations continue to compile/run unchanged while new implementations can override the supplier-based method for JDBC/R2DBC parity.
| default boolean supports(Capability capability, Connection connection) { | ||
| return supports(capability, () -> { | ||
| try { | ||
| return connection.getMetaData().getDatabaseProductName(); | ||
| } catch (SQLException e) { | ||
| return "Unknown"; | ||
| } | ||
| }); | ||
| } |
There was a problem hiding this comment.
Changing the SPI contract from supports(Capability, Connection) to supports(Capability, Supplier<String>) is a source/binary breaking change for any external ConnectionCapabilities implementations loaded via Java SPI. To preserve compatibility, consider keeping the original supports(Capability, Connection) as the primary method (or at least as an abstract method) and adding the supplier-based method as a default method (e.g., defaulting to true), then migrate internal call sites to prefer the supplier overload. That way existing third-party implementations continue to compile/run unchanged while new implementations can override the supplier-based method for JDBC/R2DBC parity.
| import org.junit.jupiter.api.Test; | ||
| import org.junit.jupiter.api.condition.DisabledInNativeImage; | ||
| import org.junit.jupiter.params.ParameterizedTest; | ||
| import org.junit.jupiter.params.provider.CsvSource; | ||
| import org.junit.jupiter.params.provider.ValueSource; | ||
|
|
||
| import java.lang.reflect.Proxy; | ||
| import java.sql.Connection; | ||
| import java.sql.DatabaseMetaData; | ||
| import java.sql.SQLException; | ||
|
|
||
| import static org.junit.jupiter.api.Assertions.assertEquals; |
There was a problem hiding this comment.
These imports appear unused in the file and will fail compilation under javac (unused imports are compilation errors). Remove the unused imports (e.g. CsvSource, SQLException, and assertEquals) or update the test to actually use them.
| import org.junit.jupiter.api.Test; | |
| import org.junit.jupiter.api.condition.DisabledInNativeImage; | |
| import org.junit.jupiter.params.ParameterizedTest; | |
| import org.junit.jupiter.params.provider.CsvSource; | |
| import org.junit.jupiter.params.provider.ValueSource; | |
| import java.lang.reflect.Proxy; | |
| import java.sql.Connection; | |
| import java.sql.DatabaseMetaData; | |
| import java.sql.SQLException; | |
| import static org.junit.jupiter.api.Assertions.assertEquals; | |
| import org.junit.jupiter.api.condition.DisabledInNativeImage; | |
| import org.junit.jupiter.params.ParameterizedTest; | |
| import org.junit.jupiter.params.provider.ValueSource; | |
| import java.lang.reflect.Proxy; | |
| import java.sql.Connection; | |
| import java.sql.DatabaseMetaData; |
| if (columns.isEmpty()) { | ||
| builder = INSERT_INTO + getTableName(entity) + " DEFAULT VALUES"; | ||
| } else { | ||
| builder = INSERT_INTO + getTableName(entity) + | ||
| " (" + String.join(",", columns) + CLOSE_BRACKET + " " + | ||
| "VALUES (" + String.join(String.valueOf(COMMA), values) + CLOSE_BRACKET; | ||
| } |
There was a problem hiding this comment.
INSERT INTO <table> DEFAULT VALUES is not supported by all SQL dialects (notably MySQL/MariaDB typically require INSERT INTO <table> () VALUES ()). Since this query builder is dialect-agnostic, emitting DEFAULT VALUES unconditionally when columns is empty risks breaking inserts on those dialects. Consider generating dialect-specific SQL here (e.g. DEFAULT VALUES for SQLite/Postgres/H2/SQL Server/Oracle, but () VALUES () for MySQL/MariaDB).
There was a problem hiding this comment.
@copilot apply changes based on this feedback
There was a problem hiding this comment.
Done in commit 1f93edc. MySQL now generates INSERT INTO <table> () VALUES () while all other dialects (SQLite, Postgres, H2, SQL Server, Oracle, ANSI) continue to use INSERT INTO <table> DEFAULT VALUES.
|
|
||
| String driverClassName() default "org.sqlite.JDBC"; | ||
|
|
||
| String url() default "jdbc:sqlite:file:%s?mode=memory&cache=shared&foreign_keys=ON&busy_timeout=5000"; |
There was a problem hiding this comment.
The default url() contains a %s format placeholder, but in SQLiteDBPropertiesTestPropertyProviderFactory the URL is passed through as-is (no String.format). This likely yields a literal database name of %s, causing unrelated test classes/contexts to share the same in-memory SQLite database (cache=shared) and potentially introducing test interference/flakiness. Consider either (1) formatting the URL using name() (or a per-test unique suffix), or (2) switching to a Micronaut placeholder-based value (e.g. using ${...}), or (3) removing the placeholder and using a per-test temp file URL like the SQLiteTestingPropertyProvider does.
| String url() default "jdbc:sqlite:file:%s?mode=memory&cache=shared&foreign_keys=ON&busy_timeout=5000"; | |
| String url() default "jdbc:sqlite:file:${random.uuid}?mode=memory&cache=shared&foreign_keys=ON&busy_timeout=5000"; |
| void test() { | ||
| List<Director> directorList = List.of( | ||
| new Director("John Jones", Set.of(new Movie("Random Movie"))), | ||
| new Director("Ann Jones", Set.of(new Movie("Super Hero Movie"), new Movie("Anther Movie with Heroes"))) |
There was a problem hiding this comment.
Typo in test data string.
| new Director("Ann Jones", Set.of(new Movie("Super Hero Movie"), new Movie("Anther Movie with Heroes"))) | |
| new Director("Ann Jones", Set.of(new Movie("Super Hero Movie"), new Movie("Another Movie with Heroes"))) |
Agent-Logs-Url: https://github.com/micronaut-projects/micronaut-data/sessions/91df067e-e59d-41d4-bec5-8403d6c24930 Co-authored-by: sdelamo <864788+sdelamo@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
| "datasources.default.url", sqliteDbProperties.url(), | ||
| "datasources.default.username", sqliteDbProperties.username(), | ||
| "datasources.default.password", sqliteDbProperties.password() | ||
| ); | ||
| } |
There was a problem hiding this comment.
The SQLiteDBProperties.url() default contains a %s placeholder, but the factory uses it verbatim. This will produce an invalid JDBC URL (or an unintended file name) for tests using the annotation defaults. Format the URL with String.format(...) (e.g., using sqliteDbProperties.name() or a unique value), or change the annotation default URL to not include a placeholder.
| "datasources.default.url", sqliteDbProperties.url(), | |
| "datasources.default.username", sqliteDbProperties.username(), | |
| "datasources.default.password", sqliteDbProperties.password() | |
| ); | |
| } | |
| "datasources.default.url", resolveUrl(sqliteDbProperties), | |
| "datasources.default.username", sqliteDbProperties.username(), | |
| "datasources.default.password", sqliteDbProperties.password() | |
| ); | |
| } | |
| private static String resolveUrl(SQLiteDBProperties sqliteDbProperties) { | |
| String url = sqliteDbProperties.url(); | |
| if (url.contains("%s")) { | |
| return String.format(url, sqliteDbProperties.name()); | |
| } | |
| return url; | |
| } |
| /** | ||
| * Defines the capabilities of a {@link Connection}. | ||
| * Defines the capabilities of a database connection. | ||
| * <p> | ||
| * The primary API is {@link #supports(Capability, Supplier)}, which accepts a supplier of | ||
| * the database product name so that capability detection works for both JDBC | ||
| * ({@link Connection}) and R2DBC ({@code io.r2dbc.spi.Connection}) connections. | ||
| * Convenience overloads such as {@link #supports(Capability, Connection)} delegate to the | ||
| * supplier-based method. |
There was a problem hiding this comment.
This PR changes the public ConnectionCapabilities API/SPI (adds a new primary method signature and shifts implementers to Supplier<String>), which is a significant change beyond 'Add SQLITE Dialect' as described in the PR metadata. Please update the PR description to explicitly call out this API/SPI change (and any compatibility expectations), or split it into a separate PR if the intent is to keep this SQLite-focused.
| private ApplicationContext applicationContext() { | ||
| try { | ||
| var field = AbstractTransactionSpec.class.getDeclaredField("context"); | ||
| field.setAccessible(true); | ||
| return (ApplicationContext) field.get(this); | ||
| } catch (ReflectiveOperationException e) { | ||
| throw new IllegalStateException("Unable to access AbstractTransactionSpec context", e); | ||
| } | ||
| } |
There was a problem hiding this comment.
This test uses reflective access (setAccessible(true)) to reach into AbstractTransactionSpec. This can break under stricter JVM access controls (JPMS), security policies, or future refactors of the base test class. Prefer exposing the ApplicationContext via a protected accessor on AbstractTransactionSpec (if possible), or restructure the test to receive the context through injection/constructor setup rather than reflection.
to avoid invoking getMetadata() in the default implementations
| import java.lang.reflect.Proxy; | ||
| import java.sql.CallableStatement; | ||
| import java.util.LinkedHashMap; | ||
| import java.util.Map; |
There was a problem hiding this comment.
Unused import java.util.Map will fail Java compilation. Remove it (or use Map instead of the concrete type if that was the intent).
| import java.util.Map; |
|
|
||
| import io.micronaut.test.extensions.junit5.annotation.MicronautTest; | ||
| import jakarta.inject.Inject; | ||
| import org.junit.jupiter.api.Disabled; |
There was a problem hiding this comment.
Unused import org.junit.jupiter.api.Disabled will fail Java compilation. Remove it (or annotate a test with @Disabled if intended).
| import org.junit.jupiter.api.Disabled; |
| public @interface SQLiteDBProperties { | ||
|
|
||
| String name() default "mydb"; | ||
|
|
||
| String packages() default "io.micronaut.data.tck.entities,io.micronaut.data.tck.jdbc.entities,io.micronaut.data.jdbc.sqlite"; | ||
|
|
||
| String schemaGenerate() default "CREATE_DROP"; | ||
|
|
||
| String dialect() default "SQLITE"; | ||
|
|
||
| String dbType() default "sqlite"; | ||
|
|
||
| String driverClassName() default "org.sqlite.JDBC"; | ||
|
|
||
| String url() default "jdbc:sqlite:file:%s?mode=memory&cache=shared&foreign_keys=ON&busy_timeout=5000"; | ||
|
|
||
| String username() default ""; | ||
|
|
||
| String password() default ""; | ||
| } |
There was a problem hiding this comment.
The default url() contains a %s placeholder, but SQLiteDBPropertiesTestPropertyProviderFactory currently passes it through without formatting. With mode=memory&cache=shared, this also risks multiple tests sharing the same in-memory DB name (leading to cross-test interference/flakiness). Format the URL using name() (or a unique per-test value), or remove the placeholder and generate a unique URL in the property provider.
| case SQLITE: | ||
| if (type == UUID) { | ||
| column += " NOT NULL DEFAULT (lower(hex(randomblob(4))||'-'||hex(randomblob(2))||'-'||'4'||substr(hex(randomblob(2)),2)||'-'||substr('89ab',abs(random())%4+1,1)||substr(hex(randomblob(2)),2)||'-'||hex(randomblob(6))))"; | ||
| } | ||
| break; |
There was a problem hiding this comment.
SQLite DEFAULT (expr) has restrictions and commonly rejects non-constant / non-deterministic expressions in defaults; the randomblob(...)/random() UUID expression is likely to break schema generation at runtime. Consider not emitting a DB-side UUID default for SQLite and instead relying on Micronaut Data UUID auto-population/application-side generation, or implement UUID generation via triggers where supported.
| @Test | ||
| void bookIsCreated() { | ||
| try (ApplicationContext context = ApplicationContext.run(createProperties())) { | ||
| BookRepository bookRepository = context.getBean(SQLiteBookRepository.class); | ||
| Book book = new Book(); | ||
| book.setTitle("title"); | ||
| bookRepository.save(book); | ||
|
|
||
| assertEquals(1, bookRepository.count()); | ||
| } | ||
| } | ||
|
|
||
| @Test | ||
| void bookWasDropped() { | ||
| try (ApplicationContext context = ApplicationContext.run(createProperties())) { | ||
| BookRepository bookRepository = context.getBean(SQLiteBookRepository.class); | ||
| assertEquals(0, bookRepository.count()); | ||
| } | ||
| } |
There was a problem hiding this comment.
createProperties() creates a fresh temp SQLite database per test invocation, so bookWasDropped() doesn't actually validate CREATE_DROP behavior on the same database—it only observes an empty brand-new DB. Reuse the same DB file across both tests (e.g., @TestInstance(PER_CLASS) + shared temp file) or explicitly assert that the schema was dropped (e.g., by expecting a table-missing error) after closing the first context.
| /** | ||
| * SQLite. | ||
| */ | ||
| SQLITE(false, false, ALL_TYPES, false, true, true, true, false), |
There was a problem hiding this comment.
| SQLITE(false, false, ALL_TYPES, false, true, true, true, false), | |
| SQLITE(false, false, ALL_TYPES, false, false, false, false, false), |
I think SQLite does not support RETURNING operations
| import static org.junit.jupiter.api.Assertions.assertEquals; | ||
| import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
|
|
||
| @SQLiteDBProperties(packages = "io.micronaut.data.jdbc.sqlite.embeddedNameMapping,io.micronaut.data.tck.entities,io.micronaut.data.tck.jdbc.entities") |
There was a problem hiding this comment.
Looks like you copied all H2 tests to SQLite. H2 tests are usually added since they are fast to execute and will cover other dialects, probably will not maintain both such H2 and SQLite tests.
This pull request adds a new dialect -
SQLITE. TheANSIdialect could almost be used, but there are some small differences that I consider merit a separate dialect for SQLITE.Most classes added in this Pull-request are tests. This PR adds a test module.
test-suite-data-jdbc-sqlite. I ported the tests indata-jdbc/src/test/groovy/io/micronaut/data/jdbc/h2from Spock to JUNIT and changed the test to use the SQLITE dialect.