├── .github
├── PULL_REQUEST_TEMPLATE.md
├── dco.yml
└── workflows
│ └── project.yml
├── .gitignore
├── .mvn
├── extensions.xml
├── jvm.config
└── wrapper
│ ├── maven-wrapper.jar
│ └── maven-wrapper.properties
├── CI.adoc
├── CONTRIBUTING.adoc
├── Jenkinsfile
├── LICENSE.txt
├── README.adoc
├── SECURITY.adoc
├── ci
├── pipeline.properties
└── test.sh
├── mvnw
├── mvnw.cmd
├── org
└── antlr
│ └── v4
│ └── tool
│ └── templates
│ └── codegen
│ └── Java
│ └── Java.stg
├── pom.xml
├── settings.xml
├── spring-data-envers
├── etc
│ └── eclipse-formatter.xml
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── org
│ │ │ └── springframework
│ │ │ └── data
│ │ │ └── envers
│ │ │ └── repository
│ │ │ ├── config
│ │ │ ├── EnableEnversRepositories.java
│ │ │ └── package-info.java
│ │ │ └── support
│ │ │ ├── DefaultRevisionEntityInformation.java
│ │ │ ├── DefaultRevisionMetadata.java
│ │ │ ├── EnversRevisionRepository.java
│ │ │ ├── EnversRevisionRepositoryFactoryBean.java
│ │ │ ├── EnversRevisionRepositoryImpl.java
│ │ │ ├── ReflectionRevisionEntityInformation.java
│ │ │ └── package-info.java
│ └── resources
│ │ ├── changelog.txt
│ │ ├── license.txt
│ │ └── notice.txt
│ └── test
│ ├── java
│ └── org
│ │ └── springframework
│ │ └── data
│ │ └── envers
│ │ ├── Config.java
│ │ ├── repository
│ │ └── support
│ │ │ ├── DefaultRevisionMetadataUnitTests.java
│ │ │ ├── EnversRevisionRepositoryImplUnitTests.java
│ │ │ ├── QueryDslRepositoryIntegrationTests.java
│ │ │ └── RepositoryIntegrationTests.java
│ │ └── sample
│ │ ├── AbstractEntity.java
│ │ ├── Country.java
│ │ ├── CountryQueryDslRepository.java
│ │ ├── CountryRepository.java
│ │ ├── CustomRevisionEntity.java
│ │ ├── CustomRevisionListener.java
│ │ ├── License.java
│ │ ├── LicenseRepository.java
│ │ └── QCountry.java
│ └── resources
│ └── logback.xml
├── spring-data-jpa-distribution
├── package.json
└── pom.xml
├── spring-data-jpa
├── Spring Data JPA.sonargraph
├── aop.xml
├── formatting.xml
├── pom.xml
└── src
│ ├── jmh
│ └── java
│ │ └── org
│ │ └── springframework
│ │ └── data
│ │ └── jpa
│ │ ├── benchmark
│ │ ├── AotRepositoryQueryMethodBenchmarks.java
│ │ ├── RepositoryQueryMethodBenchmarks.java
│ │ ├── model
│ │ │ ├── IPersonProjection.java
│ │ │ ├── Person.java
│ │ │ ├── PersonDto.java
│ │ │ └── Profile.java
│ │ └── repository
│ │ │ └── PersonRepository.java
│ │ └── repository
│ │ └── query
│ │ ├── HqlParserBenchmarks.java
│ │ └── JSqlParserQueryEnhancerBenchmarks.java
│ ├── main
│ ├── antlr4
│ │ └── org
│ │ │ └── springframework
│ │ │ └── data
│ │ │ └── jpa
│ │ │ └── repository
│ │ │ └── query
│ │ │ ├── Eql.g4
│ │ │ ├── Hql.g4
│ │ │ └── Jpql.g4
│ ├── java
│ │ └── org
│ │ │ └── springframework
│ │ │ └── data
│ │ │ └── jpa
│ │ │ ├── convert
│ │ │ ├── QueryByExamplePredicateBuilder.java
│ │ │ ├── package-info.java
│ │ │ └── threeten
│ │ │ │ ├── Jsr310JpaConverters.java
│ │ │ │ └── package-info.java
│ │ │ ├── domain
│ │ │ ├── AbstractAuditable.java
│ │ │ ├── AbstractPersistable.java
│ │ │ ├── DeleteSpecification.java
│ │ │ ├── JpaSort.java
│ │ │ ├── PredicateSpecification.java
│ │ │ ├── Specification.java
│ │ │ ├── SpecificationComposition.java
│ │ │ ├── UpdateSpecification.java
│ │ │ ├── package-info.java
│ │ │ └── support
│ │ │ │ ├── AuditingBeanFactoryPostProcessor.java
│ │ │ │ ├── AuditingEntityListener.java
│ │ │ │ └── package-info.java
│ │ │ ├── mapping
│ │ │ ├── JpaMetamodelMappingContext.java
│ │ │ ├── JpaPersistentEntity.java
│ │ │ ├── JpaPersistentEntityImpl.java
│ │ │ ├── JpaPersistentProperty.java
│ │ │ ├── JpaPersistentPropertyImpl.java
│ │ │ └── package-info.java
│ │ │ ├── projection
│ │ │ ├── CollectionAwareProjectionFactory.java
│ │ │ └── package-info.java
│ │ │ ├── provider
│ │ │ ├── HibernateUtils.java
│ │ │ ├── JpaClassUtils.java
│ │ │ ├── PersistenceProvider.java
│ │ │ ├── ProxyIdAccessor.java
│ │ │ ├── QueryComment.java
│ │ │ ├── QueryExtractor.java
│ │ │ └── package-info.java
│ │ │ ├── repository
│ │ │ ├── EntityGraph.java
│ │ │ ├── JpaContext.java
│ │ │ ├── JpaRepository.java
│ │ │ ├── JpaSpecificationExecutor.java
│ │ │ ├── Lock.java
│ │ │ ├── Meta.java
│ │ │ ├── Modifying.java
│ │ │ ├── NativeQuery.java
│ │ │ ├── Query.java
│ │ │ ├── QueryHints.java
│ │ │ ├── QueryRewriter.java
│ │ │ ├── Temporal.java
│ │ │ ├── aot
│ │ │ │ ├── AotEntityGraph.java
│ │ │ │ ├── AotMetamodel.java
│ │ │ │ ├── AotQueries.java
│ │ │ │ ├── AotQuery.java
│ │ │ │ ├── AotRepositoryFragmentSupport.java
│ │ │ │ ├── EntityGraphLookup.java
│ │ │ │ ├── JpaCodeBlocks.java
│ │ │ │ ├── JpaRepositoryContributor.java
│ │ │ │ ├── JpaRuntimeHints.java
│ │ │ │ ├── NamedAotQuery.java
│ │ │ │ ├── QueriesFactory.java
│ │ │ │ ├── StringAotQuery.java
│ │ │ │ └── package-info.java
│ │ │ ├── cdi
│ │ │ │ ├── BeanManagerQueryRewriterProvider.java
│ │ │ │ ├── JpaRepositoryBean.java
│ │ │ │ ├── JpaRepositoryExtension.java
│ │ │ │ └── package-info.java
│ │ │ ├── config
│ │ │ │ ├── AuditingBeanDefinitionParser.java
│ │ │ │ ├── BeanDefinitionNames.java
│ │ │ │ ├── EnableJpaAuditing.java
│ │ │ │ ├── EnableJpaRepositories.java
│ │ │ │ ├── InspectionClassLoader.java
│ │ │ │ ├── JpaAuditingRegistrar.java
│ │ │ │ ├── JpaMetamodelMappingContextFactoryBean.java
│ │ │ │ ├── JpaRepositoriesRegistrar.java
│ │ │ │ ├── JpaRepositoryConfigExtension.java
│ │ │ │ ├── JpaRepositoryNameSpaceHandler.java
│ │ │ │ └── package-info.java
│ │ │ ├── package-info.java
│ │ │ ├── query
│ │ │ │ ├── AbstractJpaQuery.java
│ │ │ │ ├── AbstractStringBasedJpaQuery.java
│ │ │ │ ├── BadJpqlGrammarErrorListener.java
│ │ │ │ ├── BadJpqlGrammarException.java
│ │ │ │ ├── BeanFactoryQueryRewriterProvider.java
│ │ │ │ ├── CollectionUtils.java
│ │ │ │ ├── DeclaredQueries.java
│ │ │ │ ├── DeclaredQuery.java
│ │ │ │ ├── DefaultEntityQuery.java
│ │ │ │ ├── DefaultJpaEntityMetadata.java
│ │ │ │ ├── DefaultJpaQueryMethodFactory.java
│ │ │ │ ├── DefaultQueryEnhancer.java
│ │ │ │ ├── DefaultQueryRewriteInformation.java
│ │ │ │ ├── DelegatingQueryRewriter.java
│ │ │ │ ├── DtoProjectionTransformerDelegate.java
│ │ │ │ ├── EmptyIntrospectedQuery.java
│ │ │ │ ├── EmptyQueryTokenStream.java
│ │ │ │ ├── EntityQuery.java
│ │ │ │ ├── EqlCountQueryTransformer.java
│ │ │ │ ├── EqlQueryIntrospector.java
│ │ │ │ ├── EqlQueryRenderer.java
│ │ │ │ ├── EqlSortedQueryTransformer.java
│ │ │ │ ├── EscapeCharacter.java
│ │ │ │ ├── HibernateJpaParametersParameterAccessor.java
│ │ │ │ ├── HibernateQueryInformation.java
│ │ │ │ ├── HqlCountQueryTransformer.java
│ │ │ │ ├── HqlOrderExpressionVisitor.java
│ │ │ │ ├── HqlQueryIntrospector.java
│ │ │ │ ├── HqlQueryRenderer.java
│ │ │ │ ├── HqlSortedQueryTransformer.java
│ │ │ │ ├── InvalidJpaQueryMethodException.java
│ │ │ │ ├── JSqlParserQueryEnhancer.java
│ │ │ │ ├── JSqlParserUtils.java
│ │ │ │ ├── Jpa21Utils.java
│ │ │ │ ├── JpaCountQueryCreator.java
│ │ │ │ ├── JpaEntityGraph.java
│ │ │ │ ├── JpaEntityMetadata.java
│ │ │ │ ├── JpaKeysetScrollQueryCreator.java
│ │ │ │ ├── JpaParameters.java
│ │ │ │ ├── JpaParametersParameterAccessor.java
│ │ │ │ ├── JpaQueryConfiguration.java
│ │ │ │ ├── JpaQueryCreator.java
│ │ │ │ ├── JpaQueryEnhancer.java
│ │ │ │ ├── JpaQueryExecution.java
│ │ │ │ ├── JpaQueryLookupStrategy.java
│ │ │ │ ├── JpaQueryMethod.java
│ │ │ │ ├── JpaQueryMethodFactory.java
│ │ │ │ ├── JpaQueryTransformerSupport.java
│ │ │ │ ├── JpaResultConverters.java
│ │ │ │ ├── JpqlCountQueryTransformer.java
│ │ │ │ ├── JpqlQueryBuilder.java
│ │ │ │ ├── JpqlQueryCreator.java
│ │ │ │ ├── JpqlQueryIntrospector.java
│ │ │ │ ├── JpqlQueryRenderer.java
│ │ │ │ ├── JpqlSortedQueryTransformer.java
│ │ │ │ ├── JpqlUtils.java
│ │ │ │ ├── KeysetScrollDelegate.java
│ │ │ │ ├── KeysetScrollSpecification.java
│ │ │ │ ├── Meta.java
│ │ │ │ ├── NamedQuery.java
│ │ │ │ ├── NativeJpaQuery.java
│ │ │ │ ├── ParameterBinder.java
│ │ │ │ ├── ParameterBinderFactory.java
│ │ │ │ ├── ParameterBinding.java
│ │ │ │ ├── ParameterMetadataProvider.java
│ │ │ │ ├── ParametrizedQuery.java
│ │ │ │ ├── ParsedQueryIntrospector.java
│ │ │ │ ├── PartTreeJpaQuery.java
│ │ │ │ ├── PartTreeQueryCache.java
│ │ │ │ ├── PreprocessedQuery.java
│ │ │ │ ├── Procedure.java
│ │ │ │ ├── ProcedureParameter.java
│ │ │ │ ├── QueryEnhancer.java
│ │ │ │ ├── QueryEnhancerFactories.java
│ │ │ │ ├── QueryEnhancerFactory.java
│ │ │ │ ├── QueryEnhancerSelector.java
│ │ │ │ ├── QueryInformation.java
│ │ │ │ ├── QueryParameterSetter.java
│ │ │ │ ├── QueryParameterSetterFactory.java
│ │ │ │ ├── QueryProvider.java
│ │ │ │ ├── QueryRenderer.java
│ │ │ │ ├── QueryRewriterProvider.java
│ │ │ │ ├── QueryToken.java
│ │ │ │ ├── QueryTokenStream.java
│ │ │ │ ├── QueryTokens.java
│ │ │ │ ├── QueryTransformers.java
│ │ │ │ ├── QueryUtils.java
│ │ │ │ ├── ScrollDelegate.java
│ │ │ │ ├── SimilarityNormalizer.java
│ │ │ │ ├── SimpleJpaQuery.java
│ │ │ │ ├── StoredProcedureAttributeSource.java
│ │ │ │ ├── StoredProcedureAttributes.java
│ │ │ │ ├── StoredProcedureJpaQuery.java
│ │ │ │ ├── TemplatedQuery.java
│ │ │ │ └── package-info.java
│ │ │ └── support
│ │ │ │ ├── CrudMethodMetadata.java
│ │ │ │ ├── CrudMethodMetadataPostProcessor.java
│ │ │ │ ├── DefaultJpaContext.java
│ │ │ │ ├── DefaultQueryHints.java
│ │ │ │ ├── EntityGraphFactory.java
│ │ │ │ ├── EntityManagerBeanDefinitionRegistrarPostProcessor.java
│ │ │ │ ├── FetchableFluentQueryByPredicate.java
│ │ │ │ ├── FetchableFluentQueryBySpecification.java
│ │ │ │ ├── FluentQuerySupport.java
│ │ │ │ ├── JakartaTuple.java
│ │ │ │ ├── JpaEntityInformation.java
│ │ │ │ ├── JpaEntityInformationSupport.java
│ │ │ │ ├── JpaEvaluationContextExtension.java
│ │ │ │ ├── JpaMetamodelEntityInformation.java
│ │ │ │ ├── JpaPersistableEntityInformation.java
│ │ │ │ ├── JpaRepositoryConfigurationAware.java
│ │ │ │ ├── JpaRepositoryFactory.java
│ │ │ │ ├── JpaRepositoryFactoryBean.java
│ │ │ │ ├── JpaRepositoryFragmentsContributor.java
│ │ │ │ ├── JpaRepositoryImplementation.java
│ │ │ │ ├── JpqlQueryTemplates.java
│ │ │ │ ├── MutableQueryHints.java
│ │ │ │ ├── QueryHintValue.java
│ │ │ │ ├── QueryHints.java
│ │ │ │ ├── Querydsl.java
│ │ │ │ ├── QuerydslContributor.java
│ │ │ │ ├── QuerydslJpaPredicateExecutor.java
│ │ │ │ ├── QuerydslRepositorySupport.java
│ │ │ │ ├── SimpleJpaRepository.java
│ │ │ │ ├── SpringDataJpaQuery.java
│ │ │ │ └── package-info.java
│ │ │ ├── support
│ │ │ ├── ClasspathScanningPersistenceUnitPostProcessor.java
│ │ │ ├── MergingPersistenceUnitManager.java
│ │ │ ├── PageableUtils.java
│ │ │ └── package-info.java
│ │ │ └── util
│ │ │ ├── BeanDefinitionUtils.java
│ │ │ ├── HibernateProxyDetector.java
│ │ │ ├── JpaMetamodel.java
│ │ │ ├── JpaMetamodelCacheCleanup.java
│ │ │ ├── TupleBackedMap.java
│ │ │ └── package-info.java
│ └── resources
│ │ ├── META-INF
│ │ ├── services
│ │ │ └── jakarta.enterprise.inject.spi.Extension
│ │ ├── spring.factories
│ │ ├── spring.handlers
│ │ ├── spring.schemas
│ │ ├── spring.tooling
│ │ └── spring
│ │ │ └── aot.factories
│ │ ├── license.txt
│ │ ├── notice.txt
│ │ ├── org
│ │ └── springframework
│ │ │ └── data
│ │ │ └── jpa
│ │ │ └── repository
│ │ │ └── config
│ │ │ ├── spring-jpa-1.0.xsd
│ │ │ ├── spring-jpa-1.1.xsd
│ │ │ ├── spring-jpa-1.11.xsd
│ │ │ ├── spring-jpa-1.2.xsd
│ │ │ ├── spring-jpa-1.3.xsd
│ │ │ └── spring-jpa-1.8.xsd
│ │ └── readme.txt
│ └── test
│ ├── java
│ └── org
│ │ └── springframework
│ │ └── data
│ │ └── jpa
│ │ ├── AntlrVersionTests.java
│ │ ├── convert
│ │ ├── QueryByExamplePredicateBuilderUnitTests.java
│ │ └── threeten
│ │ │ ├── DateTimeSample.java
│ │ │ ├── Jsr310JpaConvertersIntegrationTests.java
│ │ │ └── Jsr310JpaConvertersUnitTests.java
│ │ ├── domain
│ │ ├── DeleteSpecificationUnitTests.java
│ │ ├── JpaSortTests.java
│ │ ├── PredicateSpecificationUnitTests.java
│ │ ├── SpecificationUnitTests.java
│ │ ├── UpdateSpecificationUnitTests.java
│ │ ├── sample
│ │ │ ├── AbstractAnnotatedAuditable.java
│ │ │ ├── AbstractMappedType.java
│ │ │ ├── Account.java
│ │ │ ├── Address.java
│ │ │ ├── AnnotatedAuditableUser.java
│ │ │ ├── AuditableEmbeddable.java
│ │ │ ├── AuditableEntity.java
│ │ │ ├── AuditableRole.java
│ │ │ ├── AuditableUser.java
│ │ │ ├── AuditorAwareStub.java
│ │ │ ├── Book.java
│ │ │ ├── Category.java
│ │ │ ├── Child.java
│ │ │ ├── ConcreteType1.java
│ │ │ ├── ConcreteType2.java
│ │ │ ├── CustomAbstractPersistable.java
│ │ │ ├── Customer.java
│ │ │ ├── Dummy.java
│ │ │ ├── EmbeddedIdExampleDepartment.java
│ │ │ ├── EmbeddedIdExampleEmployee.java
│ │ │ ├── EmbeddedIdExampleEmployeePK.java
│ │ │ ├── EmployeeWithName.java
│ │ │ ├── EntityWithAssignedId.java
│ │ │ ├── IdClassExampleDepartment.java
│ │ │ ├── IdClassExampleEmployee.java
│ │ │ ├── IdClassExampleEmployeePK.java
│ │ │ ├── Invoice.java
│ │ │ ├── InvoiceItem.java
│ │ │ ├── Item.java
│ │ │ ├── ItemId.java
│ │ │ ├── ItemSite.java
│ │ │ ├── ItemSiteId.java
│ │ │ ├── MailMessage.java
│ │ │ ├── MailSender.java
│ │ │ ├── MailUser.java
│ │ │ ├── Order.java
│ │ │ ├── OrmXmlEntity.java
│ │ │ ├── Owner.java
│ │ │ ├── OwnerContainer.java
│ │ │ ├── Parent.java
│ │ │ ├── PersistableWithIdClass.java
│ │ │ ├── PersistableWithIdClassPK.java
│ │ │ ├── PersistableWithSingleIdClass.java
│ │ │ ├── PersistableWithSingleIdClassPK.java
│ │ │ ├── PrimitiveVersionProperty.java
│ │ │ ├── Product.java
│ │ │ ├── Role.java
│ │ │ ├── SampleEntity.java
│ │ │ ├── SampleEntityPK.java
│ │ │ ├── SampleWithIdClass.java
│ │ │ ├── SampleWithIdClassIncludingEntity.java
│ │ │ ├── SampleWithPrimitiveId.java
│ │ │ ├── SampleWithTimestampVersion.java
│ │ │ ├── Site.java
│ │ │ ├── SpecialUser.java
│ │ │ ├── User.java
│ │ │ ├── UserSpecifications.java
│ │ │ ├── UserWithOptionalField.java
│ │ │ ├── UserWithOptionalFieldRepository.java
│ │ │ └── VersionedUser.java
│ │ └── support
│ │ │ ├── AbstractAttributeConverterIntegrationTests.java
│ │ │ ├── AnnotationAuditingBeanFactoryPostProcessorUnitTests.java
│ │ │ ├── AuditingBeanFactoryPostProcessorUnitTests.java
│ │ │ ├── AuditingEntityListenerTests.java
│ │ │ ├── AuditingEntityWithEmbeddableListenerTests.java
│ │ │ ├── AuditingNamespaceUnitTests.java
│ │ │ └── QueryByExampleWithOptionalEmptyTests.java
│ │ ├── infrastructure
│ │ ├── EclipseLinkMetamodelIntegrationTests.java
│ │ ├── HibernateMetamodelIntegrationTests.java
│ │ ├── HibernateTestUtils.java
│ │ └── MetamodelIntegrationTests.java
│ │ ├── mapping
│ │ ├── JpaMetamodelMappingContextIntegrationTests.java
│ │ ├── JpaMetamodelMappingContextUnitTests.java
│ │ └── JpaPersistentPropertyImplUnitTests.java
│ │ ├── provider
│ │ ├── PersistenceProviderIntegrationTests.java
│ │ └── PersistenceProviderUnitTests.java
│ │ ├── repository
│ │ ├── AbstractPersistableIntegrationTests.java
│ │ ├── AbstractVectorIntegrationTests.java
│ │ ├── CrudMethodMetadataUnitTests.java
│ │ ├── CustomAbstractPersistableIntegrationTests.java
│ │ ├── CustomEclipseLinkJpaVendorAdapter.java
│ │ ├── CustomHsqlHibernateJpaVendorAdaptor.java
│ │ ├── EclipseLinkEntityGraphRepositoryMethodsIntegrationTests.java
│ │ ├── EclipseLinkNamespaceUserRepositoryTests.java
│ │ ├── EclipseLinkParentRepositoryIntegrationTests.java
│ │ ├── EclipseLinkQueryByExampleIntegrationTests.java
│ │ ├── EclipseLinkRepositoryWithCompositeKeyIntegrationTests.java
│ │ ├── EclipseLinkStoredProcedureIntegrationTests.java
│ │ ├── EclipseLinkUserRepositoryFinderTests.java
│ │ ├── EntityGraphRepositoryMethodsIntegrationTests.java
│ │ ├── EntityWithAssignedIdIntegrationTests.java
│ │ ├── GreetingsFrom.java
│ │ ├── HibernateRepositoryTests.java
│ │ ├── JavaConfigUserRepositoryTests.java
│ │ ├── MappedTypeRepositoryIntegrationTests.java
│ │ ├── NamespaceUserRepositoryTests.java
│ │ ├── ORMInfrastructureTests.java
│ │ ├── OracleVectorIntegrationTests.java
│ │ ├── ParentRepositoryIntegrationTests.java
│ │ ├── PgVectorIntegrationTests.java
│ │ ├── QueryByExampleIntegrationTests.java
│ │ ├── RedeclaringRepositoryMethodsTests.java
│ │ ├── RepositoryWithCompositeKeyTests.java
│ │ ├── RepositoryWithIdClassKeyTests.java
│ │ ├── RoleRepositoryIntegrationTests.java
│ │ ├── SPR8954Tests.java
│ │ ├── SimpleJpaParameterBindingTests.java
│ │ ├── StoredProcedureIntegrationTests.java
│ │ ├── UserExcerptDto.java
│ │ ├── UserRepositoryFinderTests.java
│ │ ├── UserRepositoryStoredProcedureIntegrationTests.java
│ │ ├── UserRepositoryTests.java
│ │ ├── aot
│ │ │ ├── AotContributionIntegrationTests.java
│ │ │ ├── AotFragmentTestConfigurationSupport.java
│ │ │ ├── JpaRepositoryContributorConfigurationTests.java
│ │ │ ├── JpaRepositoryContributorIntegrationTests.java
│ │ │ ├── JpaRepositoryMetadataIntegrationTests.java
│ │ │ ├── JpaRuntimeHintsUnitTests.java
│ │ │ ├── QuerydslUserRepository.java
│ │ │ ├── StubRepositoryInformation.java
│ │ │ ├── TestJpaAotRepositoryContext.java
│ │ │ ├── UserDtoProjection.java
│ │ │ └── UserRepository.java
│ │ ├── cdi
│ │ │ ├── CdiExtensionIntegrationTests.java
│ │ │ ├── EntityManagerFactoryProducer.java
│ │ │ ├── JpaQueryRewriterWithCdiIntegrationTests.java
│ │ │ ├── JpaRepositoryExtensionUnitTests.java
│ │ │ ├── Person.java
│ │ │ ├── PersonDB.java
│ │ │ ├── PersonRepository.java
│ │ │ ├── QualifiedCustomizedCdiConfiguration.java
│ │ │ ├── QualifiedCustomizedUserRepository.java
│ │ │ ├── QualifiedCustomizedUserRepositoryBean.java
│ │ │ ├── QualifiedCustomizedUserRepositoryCustom.java
│ │ │ ├── QualifiedEntityManagerProducer.java
│ │ │ ├── QualifiedFragment.java
│ │ │ ├── QualifiedFragmentBean.java
│ │ │ ├── QualifiedPersonRepository.java
│ │ │ ├── RepositoryConsumer.java
│ │ │ ├── SamplePersonRepository.java
│ │ │ ├── SamplePersonRepositoryCustom.java
│ │ │ ├── SamplePersonRepositoryImpl.java
│ │ │ ├── Transactional.java
│ │ │ ├── TransactionalInterceptor.java
│ │ │ ├── UnqualifiedEntityManagerProducer.java
│ │ │ ├── UnqualifiedPersonRepository.java
│ │ │ └── UserDB.java
│ │ ├── config
│ │ │ ├── AbstractAuditingViaJavaConfigRepositoriesTests.java
│ │ │ ├── AbstractRepositoryConfigTests.java
│ │ │ ├── AllowNestedRepositoriesRepositoryConfigTests.java
│ │ │ ├── AuditingBeanDefinitionParserTests.java
│ │ │ ├── CustomRepositoryFactoryConfigTests.java
│ │ │ ├── DefaultAuditingViaJavaConfigRepositoriesTests.java
│ │ │ ├── ExplicitAuditingViaJavaConfigRepositoriesTests.java
│ │ │ ├── InfrastructureConfig.java
│ │ │ ├── InspectionClassLoaderUnitTests.java
│ │ │ ├── JpaAuditingRegistrarUnitTests.java
│ │ │ ├── JpaRepositoriesRegistrarIntegrationTests.java
│ │ │ ├── JpaRepositoriesRegistrarUnitTests.java
│ │ │ ├── JpaRepositoryConfigDefinitionParserTests.java
│ │ │ ├── JpaRepositoryConfigExtensionUnitTests.java
│ │ │ ├── JpaRepositoryRegistrationAotProcessorUnitTests.java
│ │ │ ├── NestedRepositoriesJavaConfigTests.java
│ │ │ ├── QueryLookupStrategyTests.java
│ │ │ ├── RepositoriesJavaConfigTests.java
│ │ │ ├── RepositoryAutoConfigTests.java
│ │ │ ├── RepositoryConfigTests.java
│ │ │ ├── TypeFilterConfigTests.java
│ │ │ └── package.html
│ │ ├── custom
│ │ │ ├── CustomGenericJpaRepository.java
│ │ │ ├── CustomGenericJpaRepositoryFactory.java
│ │ │ ├── CustomGenericJpaRepositoryFactoryBean.java
│ │ │ ├── CustomGenericRepository.java
│ │ │ ├── UserCustomExtendedRepository.java
│ │ │ └── package-info.java
│ │ ├── generics
│ │ │ ├── EclipseLinkGenericsIntegrationTests.java
│ │ │ └── GenericsIntegrationTests.java
│ │ ├── procedures
│ │ │ ├── MySqlStoredProcedureIntegrationTests.java
│ │ │ ├── PostgresStoredProcedureIntegrationTests.java
│ │ │ └── PostgresStoredProcedureNullHandlingIntegrationTests.java
│ │ ├── projections
│ │ │ ├── ProjectionJoinIntegrationTests.java
│ │ │ └── ProjectionsIntegrationTests.java
│ │ ├── query
│ │ │ ├── AbstractJpaQueryTests.java
│ │ │ ├── AbstractStringBasedJpaQueryIntegrationTests.java
│ │ │ ├── AbstractStringBasedJpaQueryUnitTests.java
│ │ │ ├── BadJpqlGrammarExceptionUnitTests.java
│ │ │ ├── CollectionUtilsUnitTests.java
│ │ │ ├── CustomNonBindableJpaParametersIntegrationTests.java
│ │ │ ├── DefaultEntityQueryUnitTests.java
│ │ │ ├── DefaultQueryEnhancerUnitTests.java
│ │ │ ├── DefaultQueryUtilsUnitTests.java
│ │ │ ├── EclipseLinkJpa21UtilsTests.java
│ │ │ ├── EclipseLinkMetaAnnotatedQueryMethodIntegrationTests.java
│ │ │ ├── EclipseLinkParameterMetadataProviderIntegrationTests.java
│ │ │ ├── EclipseLinkQueryUtilsIntegrationTests.java
│ │ │ ├── EqlComplianceTests.java
│ │ │ ├── EqlDtoQueryTransformerUnitTests.java
│ │ │ ├── EqlParserQueryEnhancerUnitTests.java
│ │ │ ├── EqlQueryRendererTests.java
│ │ │ ├── EqlQueryTransformerTests.java
│ │ │ ├── EscapeCharacterUnitTests.java
│ │ │ ├── HibernateJpaParametersParameterAccessorUnitTests.java
│ │ │ ├── HqlDtoQueryTransformerUnitTests.java
│ │ │ ├── HqlOrderExpressionVisitorUnitTests.java
│ │ │ ├── HqlParserQueryEnhancerUnitTests.java
│ │ │ ├── HqlParserUnitTests.java
│ │ │ ├── HqlQueryRendererTests.java
│ │ │ ├── HqlQueryTransformerTests.java
│ │ │ ├── JSqlParserQueryEnhancerUnitTests.java
│ │ │ ├── Jpa21UtilsTests.java
│ │ │ ├── Jpa21UtilsUnitTests.java
│ │ │ ├── JpaCountQueryCreatorIntegrationTests.java
│ │ │ ├── JpaKeysetScrollQueryCreatorTests.java
│ │ │ ├── JpaParametersParameterAccessorTests.java
│ │ │ ├── JpaParametersUnitTests.java
│ │ │ ├── JpaQueryCreatorTests.java
│ │ │ ├── JpaQueryExecutionUnitTests.java
│ │ │ ├── JpaQueryLookupStrategyUnitTests.java
│ │ │ ├── JpaQueryMethodUnitTests.java
│ │ │ ├── JpaQueryRewriteIntegrationTests.java
│ │ │ ├── JpqlDtoQueryTransformerUnitTests.java
│ │ │ ├── JpqlParserQueryEnhancerUnitTests.java
│ │ │ ├── JpqlQueryBuilderUnitTests.java
│ │ │ ├── JpqlQueryRendererTests.java
│ │ │ ├── JpqlQueryTransformerTests.java
│ │ │ ├── KeysetScrollSpecificationUnitTests.java
│ │ │ ├── LikeBindingUnitTests.java
│ │ │ ├── MetaAnnotatedQueryMethodIntegrationTests.java
│ │ │ ├── MetaAnnotatedQueryMethodUnitTests.java
│ │ │ ├── NamedOrIndexedQueryParameterSetterUnitTests.java
│ │ │ ├── NamedQueryUnitTests.java
│ │ │ ├── NativeJpaQueryUnitTests.java
│ │ │ ├── ParameterBinderUnitTests.java
│ │ │ ├── ParameterBindingParserUnitTests.java
│ │ │ ├── ParameterMetadataProviderIntegrationTests.java
│ │ │ ├── ParameterMetadataProviderUnitTests.java
│ │ │ ├── PartTreeJpaQueryIntegrationTests.java
│ │ │ ├── PartTreeQueryCacheUnitTests.java
│ │ │ ├── QueryEnhancerFactoryUnitTests.java
│ │ │ ├── QueryEnhancerTckTests.java
│ │ │ ├── QueryEnhancerUnitTests.java
│ │ │ ├── QueryParameterSetterFactoryUnitTests.java
│ │ │ ├── QueryUtilsIntegrationTests.java
│ │ │ ├── QueryUtilsUnitTests.java
│ │ │ ├── QueryWithNullLikeIntegrationTests.java
│ │ │ ├── SimilarityNormalizerUnitTests.java
│ │ │ ├── SimpleJpaQueryUnitTests.java
│ │ │ ├── StoredProcedureAttributeSourceUnitTests.java
│ │ │ ├── StoredProcedureAttributesUnitTests.java
│ │ │ ├── StubJpaParameterParameterAccessor.java
│ │ │ ├── TemplatedQueryUnitTests.java
│ │ │ ├── TestEntityQuery.java
│ │ │ └── TupleConverterUnitTests.java
│ │ ├── sample
│ │ │ ├── AnnotatedAuditableUserRepository.java
│ │ │ ├── AuditableEntityRepository.java
│ │ │ ├── AuditableUserRepository.java
│ │ │ ├── BookRepository.java
│ │ │ ├── CategoryRepository.java
│ │ │ ├── ClassWithNestedRepository.java
│ │ │ ├── ConcreteRepository1.java
│ │ │ ├── ConcreteRepository2.java
│ │ │ ├── CustomAbstractPersistableRepository.java
│ │ │ ├── DummyRepository.java
│ │ │ ├── EmployeeRepositoryWithEmbeddedId.java
│ │ │ ├── EmployeeRepositoryWithIdClass.java
│ │ │ ├── EntityWithAssignedIdRepository.java
│ │ │ ├── ItemRepository.java
│ │ │ ├── ItemSiteRepository.java
│ │ │ ├── MailMessageRepository.java
│ │ │ ├── MappedTypeRepository.java
│ │ │ ├── NameOnlyDto.java
│ │ │ ├── NameOnlyRecord.java
│ │ │ ├── ParentRepository.java
│ │ │ ├── ProductRepository.java
│ │ │ ├── RedeclaringRepositoryMethodsRepository.java
│ │ │ ├── RepositoryMethodsWithEntityGraphConfigRepository.java
│ │ │ ├── RoleRepository.java
│ │ │ ├── RoleRepositoryWithMeta.java
│ │ │ ├── SampleConfig.java
│ │ │ ├── SampleEvaluationContextExtension.java
│ │ │ ├── SiteRepository.java
│ │ │ ├── UserRepository.java
│ │ │ ├── UserRepositoryCustom.java
│ │ │ └── UserRepositoryImpl.java
│ │ └── support
│ │ │ ├── CrudMethodMetadataPopulatingMethodInterceptorUnitTests.java
│ │ │ ├── DefaultJpaContextIntegrationTests.java
│ │ │ ├── DefaultJpaContextUnitTests.java
│ │ │ ├── DefaultJpaEntityMetadataUnitTest.java
│ │ │ ├── DefaultQueryHintsTest.java
│ │ │ ├── DefaultTransactionDisablingIntegrationTests.java
│ │ │ ├── EclipseLinkJpaMetamodelEntityInformationIntegrationTests.java
│ │ │ ├── EclipseLinkJpaRepositoryTests.java
│ │ │ ├── EclipseLinkProxyIdAccessorTests.java
│ │ │ ├── EntityGraphFactoryUnitTests.java
│ │ │ ├── EntityManagerBeanDefinitionRegistrarPostProcessorIntegrationTests.java
│ │ │ ├── EntityManagerBeanDefinitionRegistrarPostProcessorUnitTests.java
│ │ │ ├── EntityManagerFactoryRefTests.java
│ │ │ ├── EntityManagerFactoryRefUnitTests.java
│ │ │ ├── FetchableFluentQueryByPredicateUnitTests.java
│ │ │ ├── HibernateJpaMetamodelEntityInformationIntegrationTests.java
│ │ │ ├── JavaConfigDefaultTransactionDisablingIntegrationTests.java
│ │ │ ├── JpaEntityInformationSupportUnitTests.java
│ │ │ ├── JpaMetamodelEntityInformationIntegrationTests.java
│ │ │ ├── JpaMetamodelEntityInformationUnitTests.java
│ │ │ ├── JpaPersistableEntityInformationUnitTests.java
│ │ │ ├── JpaRepositoryFactoryBeanEntityPathResolverIntegrationTests.java
│ │ │ ├── JpaRepositoryFactoryBeanUnitTests.java
│ │ │ ├── JpaRepositoryFactoryUnitTests.java
│ │ │ ├── JpaRepositoryFragmentsContributorUnitTests.java
│ │ │ ├── JpaRepositoryTests.java
│ │ │ ├── MailMessageRepositoryIntegrationTests.java
│ │ │ ├── MutableQueryHintsUnitTests.java
│ │ │ ├── QSimpleEntityPathResolverUnitTests_Sample.java
│ │ │ ├── QuerydslIntegrationTests.java
│ │ │ ├── QuerydslJpaPredicateExecutorUnitTests.java
│ │ │ ├── QuerydslRepositorySupportIntegrationTests.java
│ │ │ ├── QuerydslRepositorySupportTests.java
│ │ │ ├── SimpleJpaRepositoryUnitTests.java
│ │ │ ├── TestcontainerConfigSupport.java
│ │ │ ├── TransactionalRepositoryTests.java
│ │ │ ├── XmlConfigDefaultTransactionDisablingIntegrationTests.java
│ │ │ └── package.html
│ │ ├── support
│ │ ├── ClasspathScanningPersistenceUnitPostProcessorUnitTests.java
│ │ ├── EntityManagerTestUtils.java
│ │ ├── MergingPersistenceUnitManagerUnitTests.java
│ │ └── ProxyImageNameSubstitutor.java
│ │ └── util
│ │ ├── BooleanExecutionCondition.java
│ │ ├── ClassPathExclusions.java
│ │ ├── ClassPathExclusionsExtension.java
│ │ ├── DisabledOnHibernate.java
│ │ ├── DisabledOnHibernateCondition.java
│ │ ├── DisabledOnHibernateConditionTests.java
│ │ ├── FixedDate.java
│ │ ├── HidingClassLoader.java
│ │ ├── JpaMetamodelCacheCleanupIntegrationTests.java
│ │ ├── JpaMetamodelUnitTests.java
│ │ ├── PackageExcludingClassLoader.java
│ │ └── TestMetaModel.java
│ └── resources
│ ├── META-INF
│ ├── jpa-named-queries.properties
│ ├── orm.xml
│ ├── persistence-jmh.xml
│ ├── persistence.xml
│ └── persistence2.xml
│ ├── application-context.xml
│ ├── auditing
│ ├── auditing-bfpp-context.xml
│ ├── auditing-entity-listener.xml
│ ├── auditing-entity-with-embeddable-listener.xml
│ ├── auditing-namespace-context.xml
│ ├── auditing-namespace-context2.xml
│ └── auditing-namespace-context3.xml
│ ├── config
│ ├── lookup-strategies-context.xml
│ ├── namespace-application-context-h2.xml
│ ├── namespace-application-context.xml
│ ├── namespace-autoconfig-context.xml
│ ├── namespace-autoconfig-typefilter-context.xml
│ ├── namespace-customfactory-context.xml
│ └── namespace-nested-repositories-application-context.xml
│ ├── eclipselink-h2.xml
│ ├── eclipselink.xml
│ ├── hibernate.xml
│ ├── hjppa-test.xml
│ ├── infrastructure-h2.xml
│ ├── infrastructure.xml
│ ├── logback.xml
│ ├── multiple-entity-manager-context.xml
│ ├── multiple-entity-manager-integration-context.xml
│ ├── org
│ └── springframework
│ │ └── data
│ │ └── jpa
│ │ ├── repository
│ │ └── support
│ │ │ └── disable-default-transactions.xml
│ │ └── support
│ │ ├── mapping.xml
│ │ ├── module1
│ │ └── module1-orm.xml
│ │ ├── module2
│ │ └── module2-orm.xml
│ │ ├── persistence.xml
│ │ └── persistence2.xml
│ ├── scripts
│ ├── h2-init.sql
│ ├── h2-stored-procedures.sql
│ ├── hsqldb-init.sql
│ ├── mysql-stored-procedures.sql
│ ├── oracle-vector-initialize.sql
│ ├── oracle-vector.sql
│ ├── pgvector.sql
│ ├── postgres-nullable-stored-procedures.sql
│ ├── postgres-stored-procedures.sql
│ └── schema-stored-procedures.sql
│ ├── simple-persistence
│ └── simple-persistence.xml
│ └── tx-manager.xml
└── src
└── main
└── antora
├── antora-playbook.yml
├── antora.yml
├── modules
└── ROOT
│ ├── nav.adoc
│ ├── pages
│ ├── auditing.adoc
│ ├── commons
│ │ └── upgrade.adoc
│ ├── envers.adoc
│ ├── envers
│ │ ├── configuration.adoc
│ │ ├── introduction.adoc
│ │ └── usage.adoc
│ ├── index.adoc
│ ├── jpa.adoc
│ ├── jpa
│ │ ├── aot.adoc
│ │ ├── entity-persistence.adoc
│ │ ├── faq.adoc
│ │ ├── getting-started.adoc
│ │ ├── glossary.adoc
│ │ ├── jpd-misc-cdi-integration.adoc
│ │ ├── locking.adoc
│ │ ├── misc-merging-persistence-units.adoc
│ │ ├── query-methods.adoc
│ │ ├── specifications.adoc
│ │ ├── stored-procedures.adoc
│ │ ├── transactions.adoc
│ │ └── value-expressions.adoc
│ ├── repositories.adoc
│ └── repositories
│ │ ├── core-concepts.adoc
│ │ ├── core-domain-events.adoc
│ │ ├── core-extensions.adoc
│ │ ├── create-instances.adoc
│ │ ├── custom-implementations.adoc
│ │ ├── definition.adoc
│ │ ├── null-handling.adoc
│ │ ├── projections.adoc
│ │ ├── query-by-example.adoc
│ │ ├── query-keywords-reference.adoc
│ │ ├── query-methods-details.adoc
│ │ ├── query-return-types-reference.adoc
│ │ └── vector-search.adoc
│ └── partials
│ ├── vector-search-intro-include.adoc
│ ├── vector-search-method-annotated-include.adoc
│ ├── vector-search-method-derived-include.adoc
│ ├── vector-search-model-include.adoc
│ ├── vector-search-repository-include.adoc
│ ├── vector-search-scoring-include.adoc
│ └── vector-search.adoc
└── resources
└── antora-resources
└── antora.yml
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 |
7 |
8 | - [ ] You have read the [Spring Data contribution guidelines](https://github.com/spring-projects/spring-data-build/blob/master/CONTRIBUTING.adoc).
9 | - [ ] You use the code formatters provided [here](https://github.com/spring-projects/spring-data-build/tree/master/etc/ide) and have them applied to your changes. Don’t submit any formatting related changes.
10 | - [ ] You submit test cases (unit or integration tests) that back your changes.
11 | - [ ] You added yourself as author in the headers of the classes you touched. Amend the date range in the Apache license header if needed. For new types, add the license header (copy from another file and set the current year only).
12 |
--------------------------------------------------------------------------------
/.github/dco.yml:
--------------------------------------------------------------------------------
1 | require:
2 | members: false
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | .idea/
3 | .settings/
4 | *.iml
5 | .project
6 | .classpath
7 | .springBeans
8 | .sonar4clipse
9 | *.sonar4clipseExternals
10 | .DS_Store
11 | node_modules
12 | package-lock.json
13 | node
14 | build/
15 | .mvn/.develocity
16 | spring-data-jpa/gen
17 |
--------------------------------------------------------------------------------
/.mvn/extensions.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | io.spring.develocity.conventions
5 | develocity-conventions-maven-extension
6 | 0.0.22
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.mvn/jvm.config:
--------------------------------------------------------------------------------
1 | --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
2 | --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
3 | --add-exports jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED
4 | --add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED
5 | --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
6 | --add-exports jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED
7 | --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
8 | --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
9 | --add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
10 | --add-opens jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED
11 | --add-opens=java.base/java.util=ALL-UNNAMED
12 | --add-opens=java.base/java.lang.reflect=ALL-UNNAMED
13 | --add-opens=java.base/java.text=ALL-UNNAMED
14 | --add-opens=java.desktop/java.awt.font=ALL-UNNAMED
15 |
--------------------------------------------------------------------------------
/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spring-projects/spring-data-jpa/936bb31f3a3b0e2506b017c1b04eee3e7d00443a/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Thu Nov 07 09:47:17 CET 2024
2 | distributionUrl=https\://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
3 |
--------------------------------------------------------------------------------
/CONTRIBUTING.adoc:
--------------------------------------------------------------------------------
1 | = Spring Data contribution guidelines
2 |
3 | You find the contribution guidelines for Spring Data projects https://github.com/spring-projects/spring-data-build/blob/main/CONTRIBUTING.adoc[here].
4 |
--------------------------------------------------------------------------------
/SECURITY.adoc:
--------------------------------------------------------------------------------
1 | = Security Policy
2 |
3 | == Supported Versions
4 |
5 | Please see the https://spring.io/projects/spring-data-jpa[Spring Data JPA] project page for supported versions.
6 |
7 | == Reporting a Vulnerability
8 |
9 | Please don't raise security vulnerabilities here. Head over to https://pivotal.io/security to learn how to disclose them responsibly.
10 |
--------------------------------------------------------------------------------
/ci/pipeline.properties:
--------------------------------------------------------------------------------
1 | # Java versions
2 | java.main.tag=24.0.1_9-jdk-noble
3 | java.next.tag=24.0.1_9-jdk-noble
4 |
5 | # Docker container images - standard
6 | docker.java.main.image=library/eclipse-temurin:${java.main.tag}
7 | docker.java.next.image=library/eclipse-temurin:${java.next.tag}
8 |
9 | # Supported versions of MongoDB
10 | docker.mongodb.6.0.version=6.0.23
11 | docker.mongodb.7.0.version=7.0.20
12 | docker.mongodb.8.0.version=8.0.9
13 |
14 | # Supported versions of Redis
15 | docker.redis.6.version=6.2.13
16 | docker.redis.7.version=7.2.4
17 |
18 | # Docker environment settings
19 | docker.java.inside.basic=-v $HOME:/tmp/jenkins-home
20 | docker.java.inside.docker=-u root -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker -v $HOME:/tmp/jenkins-home
21 |
22 | # Credentials
23 | docker.registry=
24 | docker.credentials=hub.docker.com-springbuildmaster
25 | docker.proxy.registry=https://docker-hub.usw1.packages.broadcom.com
26 | docker.proxy.credentials=usw1_packages_broadcom_com-jenkins-token
27 | artifactory.credentials=02bd1690-b54f-4c9f-819d-a77cb7a9822c
28 | artifactory.url=https://repo.spring.io
29 | artifactory.repository.snapshot=libs-snapshot-local
30 | develocity.access-key=gradle_enterprise_secret_access_key
31 | jenkins.user.name=spring-builds+jenkins
32 |
--------------------------------------------------------------------------------
/ci/test.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash -x
2 |
3 | set -euo pipefail
4 |
5 | mkdir -p /tmp/jenkins-home/.m2/spring-data-jpa
6 | mkdir -p /tmp/jenkins-home/.m2/.develocity
7 |
8 | export JENKINS_USER=${JENKINS_USER_NAME}
9 |
10 | MAVEN_OPTS="-Duser.name=${JENKINS_USER} -Duser.home=/tmp/jenkins-home" \
11 | ./mvnw -s settings.xml \
12 | -P${PROFILE} clean dependency:list test -Dsort -U -B -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-jpa -Ddevelocity.storage.directory=/tmp/jenkins-home/.develocity-root
13 |
14 | MAVEN_OPTS="-Duser.name=${JENKINS_USER} -Duser.home=/tmp/jenkins-home" \
15 | ./mvnw -s settings.xml clean -Dscan=false -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-jpa -Ddevelocity.storage.directory=/tmp/jenkins-home/.develocity-root
16 |
--------------------------------------------------------------------------------
/settings.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 | spring-libs-snapshot
9 | ${env.ARTIFACTORY_USR}
10 | ${env.ARTIFACTORY_PSW}
11 |
12 |
13 | spring-libs-milestone
14 | ${env.ARTIFACTORY_USR}
15 | ${env.ARTIFACTORY_PSW}
16 |
17 |
18 | spring-libs-release
19 | ${env.ARTIFACTORY_USR}
20 | ${env.ARTIFACTORY_PSW}
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/spring-data-envers/src/main/java/org/springframework/data/envers/repository/config/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Classes for Envers Repositories configuration support.
3 | */
4 | @org.jspecify.annotations.NullMarked
5 | package org.springframework.data.envers.repository.config;
6 |
--------------------------------------------------------------------------------
/spring-data-envers/src/main/java/org/springframework/data/envers/repository/support/DefaultRevisionEntityInformation.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012-2025 the original author or 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 org.springframework.data.envers.repository.support;
17 |
18 | import org.hibernate.envers.DefaultRevisionEntity;
19 | import org.springframework.data.repository.history.support.RevisionEntityInformation;
20 |
21 | /**
22 | * {@link RevisionEntityInformation} for {@link DefaultRevisionEntity}.
23 | *
24 | * @author Oliver Gierke
25 | */
26 | class DefaultRevisionEntityInformation implements RevisionEntityInformation {
27 |
28 | public Class> getRevisionNumberType() {
29 | return Integer.class;
30 | }
31 |
32 | public boolean isDefaultRevisionEntity() {
33 | return true;
34 | }
35 |
36 | public Class> getRevisionEntityClass() {
37 | return DefaultRevisionEntity.class;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/spring-data-envers/src/main/java/org/springframework/data/envers/repository/support/EnversRevisionRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012-2025 the original author or 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 org.springframework.data.envers.repository.support;
17 |
18 | import java.io.Serializable;
19 |
20 | import org.springframework.data.jpa.repository.JpaRepository;
21 | import org.springframework.data.repository.NoRepositoryBean;
22 | import org.springframework.data.repository.history.RevisionRepository;
23 |
24 | /**
25 | * Convenience interface to allow pulling in {@link JpaRepository} and {@link RevisionRepository} functionality in one
26 | * go.
27 | *
28 | * @author Oliver Gierke
29 | * @author Michael Igler
30 | * @deprecated since 1.1, in favor of simply extending {@link RevisionRepository}.
31 | */
32 | @Deprecated
33 | @NoRepositoryBean
34 | public interface EnversRevisionRepository>
35 | extends RevisionRepository, JpaRepository {
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/spring-data-envers/src/main/java/org/springframework/data/envers/repository/support/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Spring Data JPA specific converter infrastructure.
3 | */
4 | @org.jspecify.annotations.NullMarked
5 | package org.springframework.data.envers.repository.support;
6 |
--------------------------------------------------------------------------------
/spring-data-envers/src/main/resources/notice.txt:
--------------------------------------------------------------------------------
1 | Spring Data Envers 2.6 M3 (2021.1.0)
2 | Copyright (c) 2015-2019 Pivotal Software, Inc.
3 |
4 | This product is licensed to you under the Apache License, Version 2.0
5 | (the "License"). You may not use this product except in compliance with
6 | the License.
7 |
8 | This product may include a number of subcomponents with separate
9 | copyright notices and license terms. Your use of the source code for
10 | these subcomponents is subject to the terms and conditions of the
11 | subcomponent's license, as noted in the license.txt file.
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/spring-data-envers/src/test/java/org/springframework/data/envers/sample/AbstractEntity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012-2025 the original author or 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 org.springframework.data.envers.sample;
17 |
18 | import jakarta.persistence.GeneratedValue;
19 | import jakarta.persistence.Id;
20 | import jakarta.persistence.MappedSuperclass;
21 |
22 | @MappedSuperclass
23 | abstract class AbstractEntity {
24 |
25 | public @Id @GeneratedValue Long id;
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/spring-data-envers/src/test/java/org/springframework/data/envers/sample/Country.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012-2025 the original author or 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 org.springframework.data.envers.sample;
17 |
18 | import jakarta.persistence.Entity;
19 |
20 | import java.time.Instant;
21 |
22 | import org.hibernate.envers.Audited;
23 |
24 | /**
25 | * Sample domain class.
26 | *
27 | * @author Oliver Gierke
28 | * @author Jens Schauder
29 | * @author Niklas Loechte
30 | */
31 | @Audited
32 | @Entity
33 | public class Country extends AbstractEntity {
34 |
35 | public String code;
36 |
37 | public Instant timestamp;
38 |
39 | public String name;
40 |
41 | public String toString() {
42 | return "Country(code=" + this.code + ", timestamp=" + this.timestamp + ", name=" + this.name + ")";
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/spring-data-envers/src/test/java/org/springframework/data/envers/sample/CountryQueryDslRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-2025 the original author or 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 org.springframework.data.envers.sample;
17 |
18 | import org.springframework.data.envers.repository.support.EnversRevisionRepository;
19 | import org.springframework.data.jpa.repository.JpaRepository;
20 | import org.springframework.data.querydsl.QuerydslPredicateExecutor;
21 |
22 | /**
23 | * Repository with QueryDsl support for {@link Country} objects.
24 | *
25 | * @author Dmytro Iaroslavskyi
26 | */
27 | public interface CountryQueryDslRepository
28 | extends EnversRevisionRepository, JpaRepository,
29 | QuerydslPredicateExecutor {
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/spring-data-envers/src/test/java/org/springframework/data/envers/sample/CountryRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012-2025 the original author or 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 org.springframework.data.envers.sample;
17 |
18 | import org.springframework.data.jpa.repository.JpaRepository;
19 | import org.springframework.data.repository.history.RevisionRepository;
20 |
21 | /**
22 | * Repository for {@link Country} objects.
23 | *
24 | * @author Oliver Gierke
25 | */
26 | public interface CountryRepository extends RevisionRepository, JpaRepository {
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/spring-data-envers/src/test/java/org/springframework/data/envers/sample/CustomRevisionListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021-2025 the original author or 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 org.springframework.data.envers.sample;
17 |
18 | import org.hibernate.envers.RevisionListener;
19 |
20 | public class CustomRevisionListener implements RevisionListener {
21 | @Override
22 | public void newRevision(Object o) {
23 | ((CustomRevisionEntity) o).setAdditionalData("some data");
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/spring-data-envers/src/test/java/org/springframework/data/envers/sample/LicenseRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012-2025 the original author or 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 org.springframework.data.envers.sample;
17 |
18 | import org.springframework.data.jpa.repository.JpaRepository;
19 | import org.springframework.data.repository.history.RevisionRepository;
20 |
21 | /**
22 | * Repository for {@link License} objects.
23 | *
24 | * @author Oliver Gierke
25 | */
26 | public interface LicenseRepository extends RevisionRepository, JpaRepository {
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/spring-data-envers/src/test/resources/logback.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | %d %5p %40.40c:%4L - %m%n
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/spring-data-jpa-distribution/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "antora": "3.2.0-alpha.6",
4 | "@antora/atlas-extension": "1.0.0-alpha.2",
5 | "@antora/collector-extension": "1.0.0-alpha.7",
6 | "@asciidoctor/tabs": "1.0.0-beta.6",
7 | "@springio/antora-extensions": "1.13.0",
8 | "@springio/asciidoctor-extensions": "1.0.0-alpha.11"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/spring-data-jpa/aop.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/jmh/java/org/springframework/data/jpa/benchmark/model/IPersonProjection.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024-2025 the original author or 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 org.springframework.data.jpa.benchmark.model;
17 |
18 | /**
19 | * @author Christoph Strobl
20 | */
21 | public interface IPersonProjection {
22 |
23 | String getFirstname();
24 | String getLastname();
25 | }
26 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/jmh/java/org/springframework/data/jpa/benchmark/model/PersonDto.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2025 the original author or 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 org.springframework.data.jpa.benchmark.model;
17 |
18 | /**
19 | * @author Mark Paluch
20 | */
21 | public record PersonDto(String firstname, String lastname) {
22 | }
23 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/jmh/java/org/springframework/data/jpa/benchmark/model/Profile.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024-2025 the original author or 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 org.springframework.data.jpa.benchmark.model;
17 |
18 | import jakarta.persistence.Entity;
19 | import jakarta.persistence.GeneratedValue;
20 | import jakarta.persistence.Id;
21 |
22 | /**
23 | * @author Christoph Strobl
24 | */
25 | @Entity
26 | public class Profile {
27 |
28 | @Id
29 | @GeneratedValue private Integer id;
30 | private String name;
31 |
32 | public Profile() {}
33 |
34 | public Profile(String name) {
35 | this.name = name;
36 | }
37 |
38 | public Integer getId() {
39 | return id;
40 | }
41 |
42 | public void setId(Integer id) {
43 | this.id = id;
44 | }
45 |
46 | public String getName() {
47 | return name;
48 | }
49 |
50 | public void setName(String name) {
51 | this.name = name;
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/main/java/org/springframework/data/jpa/convert/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Spring Data JPA specific converter infrastructure.
3 | */
4 | @org.jspecify.annotations.NullMarked
5 | package org.springframework.data.jpa.convert;
6 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/main/java/org/springframework/data/jpa/convert/threeten/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Spring Data JPA specific JSR-310 converters.
3 | */
4 | @org.jspecify.annotations.NullMarked
5 | package org.springframework.data.jpa.convert.threeten;
6 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/main/java/org/springframework/data/jpa/domain/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * JPA specific support classes to implement domain classes.
3 | */
4 | @org.jspecify.annotations.NullMarked
5 | package org.springframework.data.jpa.domain;
6 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/main/java/org/springframework/data/jpa/domain/support/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Implementation classes for auditing with JPA.
3 | */
4 | @org.jspecify.annotations.NullMarked
5 | package org.springframework.data.jpa.domain.support;
6 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/main/java/org/springframework/data/jpa/mapping/JpaPersistentEntity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012-2025 the original author or 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 org.springframework.data.jpa.mapping;
17 |
18 | import org.springframework.data.mapping.PersistentEntity;
19 |
20 | /**
21 | * Interface for a JPA-specific entity.
22 | *
23 | * @author Oliver Gierke
24 | * @since 1.3
25 | */
26 | public interface JpaPersistentEntity extends PersistentEntity {
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/main/java/org/springframework/data/jpa/mapping/JpaPersistentProperty.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012-2025 the original author or 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 org.springframework.data.jpa.mapping;
17 |
18 | import org.springframework.data.mapping.PersistentProperty;
19 |
20 | /**
21 | * Interface for a JPA-specific {@link PersistentProperty}.
22 | *
23 | * @author Oliver Gierke
24 | * @since 1.3
25 | */
26 | public interface JpaPersistentProperty extends PersistentProperty {
27 |
28 | /**
29 | * Return whether the property is considered embeddable.
30 | *
31 | * @return
32 | * @since 2.1
33 | */
34 | boolean isEmbeddable();
35 | }
36 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/main/java/org/springframework/data/jpa/mapping/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * JPA specific support classes for the Spring Data mapping subsystem.
3 | */
4 | @org.jspecify.annotations.NullMarked
5 | package org.springframework.data.jpa.mapping;
6 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/main/java/org/springframework/data/jpa/projection/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * JPA specific support projection support.
3 | */
4 | @org.jspecify.annotations.NullMarked
5 | package org.springframework.data.jpa.projection;
6 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/main/java/org/springframework/data/jpa/provider/QueryComment.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013-2025 the original author or 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 org.springframework.data.jpa.provider;
17 |
18 | import jakarta.persistence.Query;
19 |
20 | import org.jspecify.annotations.Nullable;
21 |
22 | /**
23 | * Interface to hide different implementations of query hints that insert comments into a {@link Query}.
24 | *
25 | * @author Greg Turnquist
26 | * @since 3.0
27 | */
28 | public interface QueryComment {
29 |
30 | @Nullable
31 | String getCommentHintKey();
32 |
33 | @Nullable
34 | default String getCommentHintValue(String comment) {
35 | return comment;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/main/java/org/springframework/data/jpa/provider/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * JPA provider-specific utilities.
3 | */
4 | @org.jspecify.annotations.NullMarked
5 | package org.springframework.data.jpa.provider;
6 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/Meta.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014-2025 the original author or 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 org.springframework.data.jpa.repository;
17 |
18 | import java.lang.annotation.Documented;
19 | import java.lang.annotation.ElementType;
20 | import java.lang.annotation.Retention;
21 | import java.lang.annotation.RetentionPolicy;
22 | import java.lang.annotation.Target;
23 |
24 | /**
25 | * Annotation to assign metadata to repository operations.
26 | *
27 | * @author Greg Turnquist
28 | * @since 3.0
29 | * @see org.springframework.data.jpa.repository.query.Meta
30 | */
31 | @Retention(RetentionPolicy.RUNTIME)
32 | @Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE })
33 | @Documented
34 | public @interface Meta {
35 |
36 | /**
37 | * Add a comment to the query.
38 | *
39 | * @return empty {@link String} by default.
40 | */
41 | String comment() default "";
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/aot/AotEntityGraph.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2025 the original author or 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 org.springframework.data.jpa.repository.aot;
17 |
18 | import java.util.List;
19 |
20 | import org.jspecify.annotations.Nullable;
21 |
22 | import org.springframework.data.jpa.repository.EntityGraph;
23 |
24 | /**
25 | * AOT representation of an resolved entity graph. The graph can be either named or defined by attribute paths in case
26 | * the named entity graph cannot be looked up.
27 | *
28 | * @author Mark Paluch
29 | */
30 | record AotEntityGraph(@Nullable String name, EntityGraph.EntityGraphType type, List attributePaths) {
31 | }
32 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/aot/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Ahead-of-Time (AOT) generation for Spring Data JPA repositories.
3 | */
4 | @org.jspecify.annotations.NullMarked
5 | package org.springframework.data.jpa.repository.aot;
6 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/cdi/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * CDI support for Spring Data JPA Repositories.
3 | */
4 | @org.jspecify.annotations.NullMarked
5 | package org.springframework.data.jpa.repository.cdi;
6 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/config/BeanDefinitionNames.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014-2025 the original author or 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 org.springframework.data.jpa.repository.config;
17 |
18 | /**
19 | * Helper class to manage bean definition names in a single place.
20 | *
21 | * @author Oliver Gierke
22 | * @author Thomas Darimont
23 | * @author Andrew Walters
24 | */
25 | interface BeanDefinitionNames {
26 |
27 | String JPA_MAPPING_CONTEXT_BEAN_NAME = "jpaMappingContext";
28 | String JPA_CONTEXT_BEAN_NAME = "jpaContext";
29 | String EM_BEAN_DEFINITION_REGISTRAR_POST_PROCESSOR_BEAN_NAME = "emBeanDefinitionRegistrarPostProcessor";
30 | }
31 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/config/InspectionClassLoader.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-2025 the original author or 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 org.springframework.data.jpa.repository.config;
17 |
18 | import org.springframework.instrument.classloading.ShadowingClassLoader;
19 |
20 | /**
21 | * Disposable {@link ClassLoader} used to inspect user-code classes within an isolated class loader without preventing
22 | * class transformation at a later time.
23 | *
24 | * @author Mark Paluch
25 | * @since 2.1
26 | */
27 | class InspectionClassLoader extends ShadowingClassLoader {
28 |
29 | /**
30 | * Create a new {@link InspectionClassLoader} instance.
31 | *
32 | * @param parent the parent classloader.
33 | */
34 | InspectionClassLoader(ClassLoader parent) {
35 |
36 | super(parent, true);
37 |
38 | excludePackage("org.springframework.");
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/config/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Classes for JPA namespace configuration.
3 | */
4 | @org.jspecify.annotations.NullMarked
5 | package org.springframework.data.jpa.repository.config;
6 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Interfaces and annotations for JPA specific repositories.
3 | */
4 | @org.jspecify.annotations.NullMarked
5 | package org.springframework.data.jpa.repository;
6 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/DefaultQueryRewriteInformation.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024-2025 the original author or 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 org.springframework.data.jpa.repository.query;
17 |
18 | import org.springframework.data.domain.Sort;
19 | import org.springframework.data.repository.query.ReturnedType;
20 |
21 | /**
22 | * Default {@link org.springframework.data.jpa.repository.query.QueryEnhancer.QueryRewriteInformation} implementation.
23 | *
24 | * @author Mark Paluch
25 | */
26 | record DefaultQueryRewriteInformation(Sort sort,
27 | ReturnedType returnedType) implements QueryEnhancer.QueryRewriteInformation {
28 | @Override
29 | public Sort getSort() {
30 | return sort();
31 | }
32 |
33 | @Override
34 | public ReturnedType getReturnedType() {
35 | return returnedType();
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/InvalidJpaQueryMethodException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014-2025 the original author or 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 org.springframework.data.jpa.repository.query;
17 |
18 | import java.io.Serial;
19 |
20 | /**
21 | * Signals that we encountered an invalid query method.
22 | *
23 | * @author Thomas Darimont
24 | * @author Oliver Gierke
25 | */
26 | public class InvalidJpaQueryMethodException extends RuntimeException {
27 |
28 | @Serial private static final long serialVersionUID = 1L;
29 |
30 | /**
31 | * Creates a new {@link InvalidJpaQueryMethodException} with the given message.
32 | *
33 | * @param message must not be {@literal null} or empty.
34 | */
35 | public InvalidJpaQueryMethodException(String message) {
36 | super(message);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpaEntityMetadata.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013-2025 the original author or 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 org.springframework.data.jpa.repository.query;
17 |
18 | import org.springframework.data.repository.core.EntityMetadata;
19 |
20 | /**
21 | * JPA specific extension of {@link EntityMetadata}.
22 | *
23 | * @author Oliver Gierke
24 | */
25 | public interface JpaEntityMetadata extends EntityMetadata {
26 |
27 | /**
28 | * Returns the name of the entity.
29 | *
30 | * @return
31 | */
32 | String getEntityName();
33 | }
34 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpqlQueryCreator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024-2025 the original author or 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 org.springframework.data.jpa.repository.query;
17 |
18 | import java.util.List;
19 |
20 | import org.springframework.data.domain.Sort;
21 |
22 | /**
23 | * @author Mark Paluch
24 | */
25 | interface JpqlQueryCreator {
26 |
27 | boolean useTupleQuery();
28 |
29 | String createQuery(Sort sort);
30 |
31 | List getBindings();
32 |
33 | ParameterBinder getBinder();
34 | }
35 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/QueryProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2025 the original author or 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 org.springframework.data.jpa.repository.query;
17 |
18 | /**
19 | * Interface indicating an object that contains and exposes an {@code query string}. This can be either a JPQL query
20 | * string or a SQL query string.
21 | *
22 | * @author Christoph Strobl
23 | * @author Mark Paluch
24 | * @since 4.0
25 | * @see DeclaredQuery#jpqlQuery(String)
26 | * @see DeclaredQuery#nativeQuery(String)
27 | */
28 | public interface QueryProvider {
29 |
30 | /**
31 | * Return the query string.
32 | *
33 | * @return the query string.
34 | */
35 | String getQueryString();
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/QueryToken.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024-2025 the original author or 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 org.springframework.data.jpa.repository.query;
17 |
18 | /**
19 | * Interface defining a token. Tokens are atomic elements from which queries are built. Tokens can be inline tokens that
20 | * do not require spacing or expressions that must be separated by spaces, commas, etc.
21 | *
22 | * @author Christoph Strobl
23 | * @since 3.4
24 | */
25 | interface QueryToken {
26 |
27 | /**
28 | * @return the token value (i.e. its content).
29 | */
30 | String value();
31 |
32 | /**
33 | * @return {@code true} if the token represents an expression.
34 | */
35 | default boolean isExpression() {
36 | return false;
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Query implementation to execute queries against JPA.
3 | */
4 | @org.jspecify.annotations.NullMarked
5 | package org.springframework.data.jpa.repository.query;
6 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/JpaRepositoryImplementation.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2025 the original author or 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 org.springframework.data.jpa.repository.support;
17 |
18 | import org.springframework.data.jpa.repository.JpaRepository;
19 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
20 | import org.springframework.data.repository.NoRepositoryBean;
21 |
22 | /**
23 | * SPI interface to be implemented by {@link JpaRepository} implementations.
24 | *
25 | * @author Oliver Gierke
26 | * @author Stefan Fussenegger
27 | * @author Jens Schauder
28 | */
29 | @NoRepositoryBean
30 | public interface JpaRepositoryImplementation
31 | extends JpaRepository, JpaSpecificationExecutor, JpaRepositoryConfigurationAware {
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * JPA repository implementations.
3 | */
4 | @org.jspecify.annotations.NullMarked
5 | package org.springframework.data.jpa.repository.support;
6 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/main/java/org/springframework/data/jpa/support/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Various helper classes useful when working with JPA.
3 | */
4 | @org.jspecify.annotations.NullMarked
5 | package org.springframework.data.jpa.support;
6 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/main/java/org/springframework/data/jpa/util/JpaMetamodelCacheCleanup.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-2025 the original author or 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 org.springframework.data.jpa.util;
17 |
18 | import org.springframework.beans.factory.DisposableBean;
19 | import org.springframework.context.ApplicationContext;
20 |
21 | /**
22 | * Simple component to be registered as Spring bean to clear the {@link JpaMetamodel} cache to avoid a memory leak in
23 | * applications bootstrapping multiple {@link ApplicationContext}s.
24 | *
25 | * @author Oliver Gierke
26 | * @author Sylvère Richard
27 | * @see org.springframework.data.jpa.repository.config.JpaRepositoryConfigExtension#registerBeansForRoot(org.springframework.beans.factory.support.BeanDefinitionRegistry,
28 | * org.springframework.data.repository.config.RepositoryConfigurationSource)
29 | */
30 | class JpaMetamodelCacheCleanup implements DisposableBean {
31 |
32 | @Override
33 | public void destroy() {
34 | JpaMetamodel.clear();
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/main/java/org/springframework/data/jpa/util/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Spring Data JPA utilities.
3 | */
4 | @org.jspecify.annotations.NullMarked
5 | package org.springframework.data.jpa.util;
6 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/main/resources/META-INF/services/jakarta.enterprise.inject.spi.Extension:
--------------------------------------------------------------------------------
1 | org.springframework.data.jpa.repository.cdi.JpaRepositoryExtension
--------------------------------------------------------------------------------
/spring-data-jpa/src/main/resources/META-INF/spring.factories:
--------------------------------------------------------------------------------
1 | org.springframework.data.repository.core.support.RepositoryFactorySupport=org.springframework.data.jpa.repository.support.JpaRepositoryFactory
2 | org.springframework.data.util.ProxyUtils$ProxyDetector=org.springframework.data.jpa.util.HibernateProxyDetector
3 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/main/resources/META-INF/spring.handlers:
--------------------------------------------------------------------------------
1 | http\://www.springframework.org/schema/data/jpa=org.springframework.data.jpa.repository.config.JpaRepositoryNameSpaceHandler
2 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/main/resources/META-INF/spring.tooling:
--------------------------------------------------------------------------------
1 | # Tooling related information for the JPA namespace
2 | http\://www.springframework.org/schema/data/jpa@name=JPA Namespace
3 | http\://www.springframework.org/schema/data/jpa@prefix=jpa
4 | http\://www.springframework.org/schema/data/jpa@icon=org/springframework/jdbc/config/spring-jdbc.gif
5 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/main/resources/META-INF/spring/aot.factories:
--------------------------------------------------------------------------------
1 | org.springframework.aot.hint.RuntimeHintsRegistrar=\
2 | org.springframework.data.jpa.repository.aot.JpaRuntimeHints
3 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/main/resources/notice.txt:
--------------------------------------------------------------------------------
1 | Spring Data JPA 2.7 M2 (2021.2.0)
2 | Copyright (c) [2011-2019] Pivotal Software, Inc.
3 |
4 | This product is licensed to you under the Apache License, Version 2.0 (the "License").
5 | You may not use this product except in compliance with the License.
6 |
7 | This product may include a number of subcomponents with
8 | separate copyright notices and license terms. Your use of the source
9 | code for the these subcomponents is subject to the terms and
10 | conditions of the subcomponent's license, as noted in the LICENSE file.
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/main/resources/readme.txt:
--------------------------------------------------------------------------------
1 | Spring Data JPA 1.6.0 M1 (March 31th, 2014)
2 | -------------------------------------------
3 |
4 | Spring Data Jpa is released under the terms of the Apache Software License Version 2.0 (see license.txt).
5 |
6 |
7 | DISTRIBUTION CONTENTS:
8 |
9 | The JARs are available in the 'dist' directory, and the source JARs are in the 'src' directory.
10 |
11 | The reference manual and javadoc are located in the 'docs' directory.
12 |
13 |
14 | ADDITIONAL RESOURCES:
15 |
16 | Spring Data Homepage: https://projects.spring.io/spring-data
17 | Spring Data JPA on Stackoverflow: https://stackoverflow.com/questions/tagged/spring-data-jpa
18 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/convert/threeten/DateTimeSample.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014-2025 the original author or 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 org.springframework.data.jpa.convert.threeten;
17 |
18 | import java.time.Instant;
19 | import java.time.LocalDate;
20 | import java.time.LocalDateTime;
21 | import java.time.LocalTime;
22 | import java.time.ZoneId;
23 |
24 | import jakarta.persistence.Entity;
25 | import jakarta.persistence.GeneratedValue;
26 | import jakarta.persistence.Id;
27 |
28 | /**
29 | * @author Oliver Gierke
30 | */
31 | @Entity
32 | public class DateTimeSample {
33 |
34 | @Id @GeneratedValue Long id;
35 | Instant instant;
36 | LocalDate localDate;
37 | LocalTime localTime;
38 | LocalDateTime localDateTime;
39 | ZoneId zoneId;
40 | }
41 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/AbstractMappedType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013-2025 the original author or 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 org.springframework.data.jpa.domain.sample;
17 |
18 | import jakarta.persistence.GeneratedValue;
19 | import jakarta.persistence.Id;
20 | import jakarta.persistence.MappedSuperclass;
21 | import jakarta.persistence.Version;
22 |
23 | /**
24 | * @author Thomas Darimont
25 | * @author Oliver Gierke
26 | */
27 | @MappedSuperclass
28 | public abstract class AbstractMappedType {
29 |
30 | @Id
31 | @GeneratedValue Long id;
32 | @Version Long version;
33 | private String attribute1;
34 |
35 | AbstractMappedType() {}
36 |
37 | AbstractMappedType(String attribute1) {
38 | this.attribute1 = attribute1;
39 | }
40 |
41 | public Long getId() {
42 | return this.id;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/Account.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2008-2025 the original author or 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 org.springframework.data.jpa.domain.sample;
17 |
18 | import jakarta.persistence.Entity;
19 |
20 | import org.springframework.data.jpa.domain.AbstractPersistable;
21 |
22 | /**
23 | * @author Oliver Gierke
24 | */
25 | @Entity
26 | public class Account extends AbstractPersistable {
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/AnnotatedAuditableUser.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014-2025 the original author or 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 org.springframework.data.jpa.domain.sample;
17 |
18 | import jakarta.persistence.Entity;
19 |
20 | /**
21 | * @author Oliver Gierke
22 | * @since 1.6
23 | */
24 | @Entity
25 | public class AnnotatedAuditableUser extends AbstractAnnotatedAuditable {
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/AuditableRole.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2008-2025 the original author or 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 org.springframework.data.jpa.domain.sample;
17 |
18 | import jakarta.persistence.Entity;
19 |
20 | import org.springframework.data.jpa.domain.AbstractAuditable;
21 |
22 | /**
23 | * Sample auditable role entity.
24 | *
25 | * @author Oliver Gierke
26 | */
27 | @Entity
28 | public class AuditableRole extends AbstractAuditable {
29 |
30 | private String name;
31 |
32 | public void setName(String name) {
33 |
34 | this.name = name;
35 | }
36 |
37 | public String getName() {
38 |
39 | return name;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/Book.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2008-2025 the original author or 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 org.springframework.data.jpa.domain.sample;
17 |
18 | import jakarta.persistence.Entity;
19 | import jakarta.persistence.GeneratedValue;
20 | import jakarta.persistence.Id;
21 |
22 | /**
23 | * @author Yanming Zhou
24 | */
25 | @Entity
26 | public class Book extends OwnerContainer {
27 |
28 | @Id
29 | @GeneratedValue
30 | private Long id;
31 |
32 | public Long getId() {
33 | return id;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/Category.java:
--------------------------------------------------------------------------------
1 | package org.springframework.data.jpa.domain.sample;
2 |
3 | import jakarta.persistence.Entity;
4 | import jakarta.persistence.FetchType;
5 | import jakarta.persistence.GeneratedValue;
6 | import jakarta.persistence.Id;
7 | import jakarta.persistence.ManyToOne;
8 |
9 | @Entity
10 | public class Category {
11 |
12 | @Id @GeneratedValue private Long id;
13 |
14 | @ManyToOne(fetch = FetchType.LAZY)//
15 | private Product product;
16 |
17 | public Category(Product product) {
18 | this.product = product;
19 | }
20 |
21 | protected Category() {}
22 |
23 | public Long getId() {
24 | return id;
25 | }
26 |
27 | public Product getProduct() {
28 | return product;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/Child.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013-2025 the original author or 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 org.springframework.data.jpa.domain.sample;
17 |
18 | import java.util.HashSet;
19 | import java.util.Set;
20 |
21 | import jakarta.persistence.Entity;
22 | import jakarta.persistence.GeneratedValue;
23 | import jakarta.persistence.Id;
24 | import jakarta.persistence.ManyToMany;
25 |
26 | @Entity
27 | public class Child {
28 |
29 | @Id
30 | @GeneratedValue
31 | Long id;
32 |
33 | @ManyToMany(mappedBy = "children")
34 | Set parents = new HashSet<>();
35 |
36 | public Child add(Parent parent) {
37 |
38 | this.parents.add(parent);
39 |
40 | if (!parent.children.contains(this)) {
41 | parent.add(this);
42 | }
43 |
44 | return this;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/ConcreteType1.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013-2025 the original author or 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 org.springframework.data.jpa.domain.sample;
17 |
18 | import jakarta.persistence.Entity;
19 |
20 | /**
21 | * @author Thomas Darimont
22 | */
23 | @Entity
24 | public class ConcreteType1 extends AbstractMappedType {
25 |
26 | public ConcreteType1() {}
27 |
28 | public ConcreteType1(String attribute1) {
29 | super(attribute1);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/ConcreteType2.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013-2025 the original author or 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 org.springframework.data.jpa.domain.sample;
17 |
18 | import jakarta.persistence.Entity;
19 |
20 | /**
21 | * @author Thomas Darimont
22 | */
23 | @Entity
24 | public class ConcreteType2 extends AbstractMappedType {
25 |
26 | public ConcreteType2() {}
27 |
28 | public ConcreteType2(String attribute1) {
29 | super(attribute1);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/CustomAbstractPersistable.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014-2025 the original author or 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 org.springframework.data.jpa.domain.sample;
17 |
18 | import jakarta.persistence.Entity;
19 | import jakarta.persistence.Table;
20 |
21 | import org.springframework.data.jpa.domain.AbstractPersistable;
22 |
23 | /**
24 | * @author Thomas Darimont
25 | */
26 | @Entity
27 | @Table(name = "customAbstractPersistable")
28 | public class CustomAbstractPersistable extends AbstractPersistable {
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/Customer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013-2025 the original author or 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 org.springframework.data.jpa.domain.sample;
17 |
18 | import jakarta.persistence.Entity;
19 | import jakarta.persistence.Id;
20 |
21 | /**
22 | * @author Oliver Gierke
23 | * @author Patrice Blanchardie
24 | */
25 | @Entity
26 | public class Customer {
27 |
28 | @Id Long id;
29 |
30 | String name;
31 | }
32 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/EntityWithAssignedId.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2025 the original author or 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 org.springframework.data.jpa.domain.sample;
17 |
18 | import java.util.UUID;
19 |
20 | import jakarta.persistence.Entity;
21 | import jakarta.persistence.Id;
22 | import jakarta.persistence.PostLoad;
23 | import jakarta.persistence.PrePersist;
24 | import jakarta.persistence.Transient;
25 |
26 | import org.springframework.data.domain.Persistable;
27 |
28 | /**
29 | * @author Oliver Drotbohm
30 | */
31 | @Entity
32 | public class EntityWithAssignedId implements Persistable {
33 |
34 | private @Id UUID id = UUID.randomUUID();
35 |
36 | private @Transient boolean isNew = true;
37 |
38 | @Override
39 | public UUID getId() {
40 | return id;
41 | }
42 |
43 | @Override
44 | public boolean isNew() {
45 | return isNew;
46 | }
47 |
48 | @PrePersist
49 | @PostLoad
50 | public void markNotNew() {
51 | this.isNew = false;
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/Invoice.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020-2025 the original author or 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 org.springframework.data.jpa.domain.sample;
17 |
18 | import jakarta.persistence.Entity;
19 | import jakarta.persistence.Id;
20 | import jakarta.persistence.ManyToOne;
21 | import jakarta.persistence.Table;
22 |
23 | /**
24 | * @author Patrice Blanchardie
25 | */
26 | @Entity
27 | @Table(name = "INVOICES")
28 | public class Invoice {
29 |
30 | @Id Long id;
31 |
32 | @ManyToOne(optional = false) Customer customer;
33 |
34 | @ManyToOne Order order;
35 | }
36 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/InvoiceItem.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020-2025 the original author or 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 org.springframework.data.jpa.domain.sample;
17 |
18 | import jakarta.persistence.Entity;
19 | import jakarta.persistence.Id;
20 | import jakarta.persistence.ManyToOne;
21 | import jakarta.persistence.Table;
22 |
23 | /**
24 | * @author Patrice Blanchardie
25 | */
26 | @Entity
27 | @Table(name = "INVOICE_ITEMS")
28 | public class InvoiceItem {
29 |
30 | @Id Long id;
31 |
32 | @ManyToOne(optional = false) Invoice invoice;
33 | }
34 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/ItemSite.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016-2025 the original author or 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 org.springframework.data.jpa.domain.sample;
17 |
18 | import jakarta.persistence.Entity;
19 | import jakarta.persistence.Id;
20 | import jakarta.persistence.IdClass;
21 | import jakarta.persistence.ManyToOne;
22 | import jakarta.persistence.Table;
23 |
24 | /**
25 | * @author Mark Paluch
26 | * @author Aleksei Elin
27 | * @see Jakarta
28 | * Persistence Specification: Derived Identities, Example 2
29 | */
30 | @Entity
31 | @Table
32 | @IdClass(ItemSiteId.class)
33 | public class ItemSite {
34 |
35 | @Id @ManyToOne private Item item;
36 | @Id @ManyToOne private Site site;
37 |
38 | public ItemSite() {}
39 |
40 | public ItemSite(Item item, Site site) {
41 | this.item = item;
42 | this.site = site;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/Order.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013-2025 the original author or 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 org.springframework.data.jpa.domain.sample;
17 |
18 | import jakarta.persistence.Entity;
19 | import jakarta.persistence.Id;
20 | import jakarta.persistence.ManyToOne;
21 | import jakarta.persistence.Table;
22 |
23 | /**
24 | * @author Oliver Gierke
25 | */
26 | @Entity
27 | @Table(name = "ORDERS")
28 | public class Order {
29 |
30 | @Id Long id;
31 | @ManyToOne(optional = false) Customer customer;
32 | }
33 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/OrmXmlEntity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-2025 the original author or 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 org.springframework.data.jpa.domain.sample;
17 |
18 | /**
19 | * This entity serves as a test object for orm.xml configuration and MUST NOT be configured via annotations!
20 | *
21 | * @author Thomas Darimont
22 | */
23 | public class OrmXmlEntity {
24 |
25 | private Long id;
26 |
27 | private String property1;
28 |
29 | public Long getId() {
30 | return id;
31 | }
32 |
33 | public void setId(Long id) {
34 | this.id = id;
35 | }
36 |
37 | public String getProperty1() {
38 | return property1;
39 | }
40 |
41 | public void setProperty1(String property1) {
42 | this.property1 = property1;
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/Owner.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2008-2025 the original author or 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 org.springframework.data.jpa.domain.sample;
17 |
18 | import jakarta.persistence.Entity;
19 | import org.springframework.data.jpa.domain.AbstractPersistable;
20 |
21 | /**
22 | * @author Yanming Zhou
23 | */
24 | @Entity
25 | public class Owner extends AbstractPersistable {
26 |
27 | private String name;
28 |
29 | public String getName() {
30 | return name;
31 | }
32 |
33 | public void setName(String name) {
34 | this.name = name;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/OwnerContainer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2008-2025 the original author or 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 org.springframework.data.jpa.domain.sample;
17 |
18 | import jakarta.persistence.ManyToOne;
19 | import jakarta.persistence.MappedSuperclass;
20 |
21 | /**
22 | * @author Yanming Zhou
23 | */
24 | @MappedSuperclass
25 | public class OwnerContainer {
26 |
27 | @ManyToOne
28 | T owner;
29 |
30 | public T getOwner() {
31 | return owner;
32 | }
33 |
34 | public void setOwner(T owner) {
35 | this.owner = owner;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/Parent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013-2025 the original author or 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 org.springframework.data.jpa.domain.sample;
17 |
18 | import jakarta.persistence.CascadeType;
19 | import jakarta.persistence.Entity;
20 | import jakarta.persistence.GeneratedValue;
21 | import jakarta.persistence.Id;
22 | import jakarta.persistence.ManyToMany;
23 |
24 | import java.util.HashSet;
25 | import java.util.Set;
26 |
27 | @Entity
28 | public class Parent {
29 |
30 | @Id
31 | @GeneratedValue
32 | Long id;
33 |
34 | @ManyToMany(cascade = CascadeType.ALL)
35 | Set children = new HashSet<>();
36 |
37 | public Parent add(Child child) {
38 |
39 | this.children.add(child);
40 |
41 | if (!child.parents.contains(this)) {
42 | child.add(this);
43 | }
44 |
45 | return this;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/PersistableWithSingleIdClass.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021-2025 the original author or 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 org.springframework.data.jpa.domain.sample;
17 |
18 | import jakarta.persistence.Entity;
19 | import jakarta.persistence.Id;
20 | import jakarta.persistence.IdClass;
21 |
22 | /**
23 | * Sample entity using {@link IdClass} annotation to demarcate ids.
24 | *
25 | * @author Mark Paluch
26 | */
27 | @Entity
28 | @IdClass(PersistableWithSingleIdClassPK.class)
29 | public class PersistableWithSingleIdClass {
30 |
31 | @Id private Long first;
32 |
33 | protected PersistableWithSingleIdClass() {
34 |
35 | }
36 |
37 | public PersistableWithSingleIdClass(Long first) {
38 | this.first = first;
39 | }
40 |
41 | /**
42 | * @return the first
43 | */
44 | public Long getFirst() {
45 | return first;
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/PrimitiveVersionProperty.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014-2025 the original author or 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 org.springframework.data.jpa.domain.sample;
17 |
18 | import jakarta.persistence.Entity;
19 | import jakarta.persistence.GeneratedValue;
20 | import jakarta.persistence.Id;
21 | import jakarta.persistence.Version;
22 |
23 | /**
24 | * @author Oliver Gierke
25 | * @author Christoph Strobl
26 | */
27 | @Entity
28 | public class PrimitiveVersionProperty {
29 |
30 | public @Id @GeneratedValue Long id;
31 | public @Version long version;
32 |
33 | public String someValue;
34 | }
35 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/Product.java:
--------------------------------------------------------------------------------
1 | package org.springframework.data.jpa.domain.sample;
2 |
3 | import jakarta.persistence.Entity;
4 | import jakarta.persistence.GeneratedValue;
5 | import jakarta.persistence.Id;
6 |
7 | @Entity
8 | public class Product {
9 |
10 | @Id @GeneratedValue private Long id;
11 |
12 | public Long getId() {
13 | return id;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/SampleWithIdClass.java:
--------------------------------------------------------------------------------
1 | package org.springframework.data.jpa.domain.sample;
2 |
3 | import jakarta.persistence.Access;
4 | import jakarta.persistence.AccessType;
5 | import jakarta.persistence.Entity;
6 | import jakarta.persistence.Id;
7 | import jakarta.persistence.IdClass;
8 |
9 | import java.io.Serializable;
10 |
11 | @Entity
12 | @IdClass(SampleWithIdClass.SampleWithIdClassPK.class)
13 | @Access(AccessType.FIELD)
14 | public class SampleWithIdClass {
15 |
16 | @Id Long first;
17 | @Id Long second;
18 |
19 | @SuppressWarnings("serial")
20 | static class SampleWithIdClassPK implements Serializable {
21 |
22 | Long first;
23 | Long second;
24 |
25 | @Override
26 | public boolean equals(Object obj) {
27 |
28 | if (obj == this) {
29 | return true;
30 | }
31 |
32 | if (!(obj instanceof SampleWithIdClassPK that)) {
33 | return false;
34 | }
35 |
36 | return this.first.equals(that.first) && this.second.equals(that.second);
37 | }
38 |
39 | @Override
40 | public int hashCode() {
41 | return first.hashCode() + second.hashCode();
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/SampleWithPrimitiveId.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013-2025 the original author or 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 org.springframework.data.jpa.domain.sample;
17 |
18 | import jakarta.persistence.Entity;
19 | import jakarta.persistence.Id;
20 |
21 | /**
22 | * @author Oliver Gierke
23 | */
24 | @Entity
25 | public class SampleWithPrimitiveId {
26 |
27 | @Id private long id;
28 |
29 | public void setId(long id) {
30 | this.id = id;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/SampleWithTimestampVersion.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014-2025 the original author or 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 org.springframework.data.jpa.domain.sample;
17 |
18 | import java.sql.Timestamp;
19 |
20 | import jakarta.persistence.Entity;
21 | import jakarta.persistence.Id;
22 | import jakarta.persistence.Version;
23 |
24 | @Entity
25 | public class SampleWithTimestampVersion {
26 |
27 | public @Id Long id;
28 | public @Version Timestamp version;
29 | }
30 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/SpecialUser.java:
--------------------------------------------------------------------------------
1 | package org.springframework.data.jpa.domain.sample;
2 |
3 | import jakarta.persistence.Entity;
4 |
5 | /**
6 | * @author Oliver Gierke
7 | */
8 | @Entity
9 | public class SpecialUser extends User {
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/UserWithOptionalFieldRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2008-2025 the original author or 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 org.springframework.data.jpa.domain.sample;
17 |
18 | import org.springframework.data.jpa.repository.JpaRepository;
19 |
20 | /**
21 | * @author Greg Turnquist
22 | */
23 | public interface UserWithOptionalFieldRepository extends JpaRepository {}
24 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/VersionedUser.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013-2025 the original author or 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 org.springframework.data.jpa.domain.sample;
17 |
18 | import jakarta.persistence.Entity;
19 | import jakarta.persistence.GeneratedValue;
20 | import jakarta.persistence.Id;
21 | import jakarta.persistence.Version;
22 |
23 | /**
24 | * @author Oliver Gierke
25 | */
26 | @Entity
27 | public class VersionedUser {
28 |
29 | @Id
30 | @GeneratedValue
31 | private Long id;
32 |
33 | @Version
34 | private Long version;
35 |
36 | public Long getId() {
37 | return id;
38 | }
39 |
40 | public void setId(Long id) {
41 | this.id = id;
42 | }
43 |
44 | public Long getVersion() {
45 | return version;
46 | }
47 |
48 | public void setVersion(Long version) {
49 | this.version = version;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/infrastructure/HibernateMetamodelIntegrationTests.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-2025 the original author or 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 org.springframework.data.jpa.infrastructure;
17 |
18 | import org.junit.jupiter.api.Disabled;
19 | import org.junit.jupiter.api.Test;
20 |
21 | /**
22 | * Hibernate-specific integration test using the JPA metamodel.
23 | *
24 | * @author Oliver Gierke
25 | * @soundtrack Umphrey's McGee - Intentions Clear (Safety In Numbers)
26 | */
27 | class HibernateMetamodelIntegrationTests extends MetamodelIntegrationTests {
28 |
29 | @Test
30 | @Disabled
31 | @Override
32 | void pathToEntityIsOfBindableTypeEntityType() {}
33 |
34 | @Test
35 | @Disabled
36 | @Override
37 | void considersOneToOneAttributeAnAssociation() {}
38 |
39 | /**
40 | * @see HHH-10341
41 | */
42 | @Test
43 | @Disabled
44 | @Override
45 | void doesNotExposeAliasForTupleIfNoneDefined() {}
46 | }
47 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/EclipseLinkParentRepositoryIntegrationTests.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013-2025 the original author or 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 org.springframework.data.jpa.repository;
17 |
18 | import org.springframework.test.context.ContextConfiguration;
19 |
20 | @ContextConfiguration("classpath:eclipselink.xml")
21 | class EclipseLinkParentRepositoryIntegrationTests extends ParentRepositoryIntegrationTests {
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/EclipseLinkRepositoryWithCompositeKeyIntegrationTests.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016-2025 the original author or 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 org.springframework.data.jpa.repository;
17 |
18 | import org.springframework.context.annotation.ImportResource;
19 | import org.springframework.test.context.ContextConfiguration;
20 |
21 | /**
22 | * Testcase to run {@link RepositoryWithIdClassKeyTests} integration tests on top of EclipseLink.
23 | *
24 | * @author Mark Paluch
25 | */
26 | @ContextConfiguration
27 | class EclipseLinkRepositoryWithCompositeKeyIntegrationTests extends RepositoryWithIdClassKeyTests {
28 |
29 | @ImportResource({ "classpath:infrastructure.xml", "classpath:eclipselink.xml" })
30 | static class TestConfig extends Config {}
31 | }
32 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/GreetingsFrom.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024-2025 the original author or 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 org.springframework.data.jpa.repository;
17 |
18 | /**
19 | * A trivial component registered via {@literal appication-context.xml} to be called from SpEL.
20 | */
21 | public class GreetingsFrom {
22 |
23 | public String groot(String name) {
24 | return "(%s) - I am Groot!".formatted(name);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/UserExcerptDto.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2025 the original author or 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 org.springframework.data.jpa.repository;
17 |
18 | /**
19 | * Hibernate is still a bit picky on records so let's use a class, just in case.
20 | *
21 | * @author Christoph Strobl
22 | */
23 | public class UserExcerptDto {
24 |
25 | private String firstname;
26 | private String lastname;
27 |
28 | public UserExcerptDto(String firstname, String lastname) {
29 | this.firstname = firstname;
30 | this.lastname = lastname;
31 | }
32 |
33 | public String getFirstname() {
34 | return firstname;
35 | }
36 |
37 | public void setFirstname(String firstname) {
38 | this.firstname = firstname;
39 | }
40 |
41 | public String getLastname() {
42 | return lastname;
43 | }
44 |
45 | public void setLastname(String lastname) {
46 | this.lastname = lastname;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/aot/QuerydslUserRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2025 the original author or 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 org.springframework.data.jpa.repository.aot;
17 |
18 | import java.util.List;
19 |
20 | import org.springframework.data.jpa.domain.sample.User;
21 | import org.springframework.data.querydsl.QuerydslPredicateExecutor;
22 | import org.springframework.data.repository.CrudRepository;
23 |
24 | interface QuerydslUserRepository extends CrudRepository, QuerydslPredicateExecutor {
25 |
26 | List findUserNoArgumentsBy();
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/aot/UserDtoProjection.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2025 the original author or 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 org.springframework.data.jpa.repository.aot;
17 |
18 | /**
19 | * @author Christoph Strobl
20 | * @since 2025/01
21 | */
22 | public class UserDtoProjection {
23 |
24 | private final String firstname;
25 | private final String emailAddress;
26 |
27 | public UserDtoProjection(String firstname, String emailAddress) {
28 | this.firstname = firstname;
29 | this.emailAddress = emailAddress;
30 | }
31 |
32 | public String getFirstname() {
33 | return firstname;
34 | }
35 |
36 | public String getEmailAddress() {
37 | return emailAddress;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/cdi/EntityManagerFactoryProducer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011-2025 the original author or 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 org.springframework.data.jpa.repository.cdi;
17 |
18 | import jakarta.enterprise.context.ApplicationScoped;
19 | import jakarta.enterprise.inject.Disposes;
20 | import jakarta.enterprise.inject.Produces;
21 | import jakarta.persistence.EntityManagerFactory;
22 | import jakarta.persistence.Persistence;
23 |
24 | /**
25 | * Produces and {@link EntityManagerFactory}.
26 | *
27 | * @author Dirk Mahler
28 | * @author Jens Schauder
29 | */
30 | class EntityManagerFactoryProducer {
31 |
32 | @Produces
33 | @ApplicationScoped
34 | public EntityManagerFactory createEntityManagerFactory() {
35 | return Persistence.createEntityManagerFactory("cdi");
36 | }
37 |
38 | public void close(@Disposes EntityManagerFactory entityManagerFactory) {
39 | entityManagerFactory.close();
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/cdi/Person.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011-2025 the original author or 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 org.springframework.data.jpa.repository.cdi;
17 |
18 | import jakarta.persistence.Entity;
19 | import jakarta.persistence.GeneratedValue;
20 | import jakarta.persistence.GenerationType;
21 | import jakarta.persistence.Id;
22 |
23 | @Entity
24 | class Person {
25 |
26 | @Id
27 | @GeneratedValue(strategy = GenerationType.AUTO)
28 | private long id;
29 |
30 | private String name;
31 |
32 | public long getId() {
33 | return id;
34 | }
35 |
36 | public void setId(long id) {
37 | this.id = id;
38 | }
39 |
40 | public String getName() {
41 | return name;
42 | }
43 |
44 | public void setName(String name) {
45 | this.name = name;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/cdi/PersonDB.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011-2025 the original author or 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 org.springframework.data.jpa.repository.cdi;
17 |
18 | import java.lang.annotation.ElementType;
19 | import java.lang.annotation.Retention;
20 | import java.lang.annotation.RetentionPolicy;
21 | import java.lang.annotation.Target;
22 |
23 | import jakarta.inject.Qualifier;
24 |
25 | @Qualifier
26 | @Retention(RetentionPolicy.RUNTIME)
27 | @Target({ ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER })
28 | @interface PersonDB {
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/cdi/PersonRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011-2025 the original author or 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 org.springframework.data.jpa.repository.cdi;
17 |
18 | import java.util.List;
19 |
20 | import org.springframework.data.repository.cdi.Eager;
21 |
22 | @Eager
23 | public interface PersonRepository {
24 |
25 | List findAll();
26 |
27 | void save(Person person);
28 | }
29 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/cdi/QualifiedCustomizedCdiConfiguration.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014-2025 the original author or 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 | package org.springframework.data.jpa.repository.cdi;
18 |
19 | import org.springframework.data.repository.cdi.CdiRepositoryConfiguration;
20 |
21 | /**
22 | * @author Mark Paluch
23 | */
24 | @UserDB
25 | class QualifiedCustomizedCdiConfiguration implements CdiRepositoryConfiguration {
26 |
27 | @Override
28 | public String getRepositoryImplementationPostfix() {
29 | return "Bean";
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/cdi/QualifiedCustomizedUserRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014-2025 the original author or 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 org.springframework.data.jpa.repository.cdi;
17 |
18 | import org.springframework.data.jpa.domain.sample.User;
19 | import org.springframework.data.repository.Repository;
20 |
21 | /**
22 | * @author Mark Paluch
23 | */
24 | @UserDB
25 | public interface QualifiedCustomizedUserRepository extends Repository,
26 | QualifiedCustomizedUserRepositoryCustom, QualifiedFragment {
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/cdi/QualifiedCustomizedUserRepositoryBean.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014-2025 the original author or 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 | package org.springframework.data.jpa.repository.cdi;
18 |
19 | /**
20 | * @author Mark Paluch
21 | */
22 | @UserDB
23 | public class QualifiedCustomizedUserRepositoryBean implements QualifiedCustomizedUserRepositoryCustom {
24 |
25 | @Override
26 | public void doSomething() {}
27 | }
28 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/cdi/QualifiedCustomizedUserRepositoryCustom.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014-2025 the original author or 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 | package org.springframework.data.jpa.repository.cdi;
18 |
19 | /**
20 | * @author Mark Paluch
21 | */
22 | interface QualifiedCustomizedUserRepositoryCustom {
23 |
24 | void doSomething();
25 | }
26 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/cdi/QualifiedFragment.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-2025 the original author or 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 org.springframework.data.jpa.repository.cdi;
17 |
18 | /**
19 | * @author Mark Paluch
20 | */
21 | interface QualifiedFragment {
22 | int returnOne();
23 | }
24 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/cdi/QualifiedFragmentBean.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-2025 the original author or 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 org.springframework.data.jpa.repository.cdi;
17 |
18 | /**
19 | * @author Mark Paluch
20 | */
21 | @UserDB
22 | public class QualifiedFragmentBean implements QualifiedFragment {
23 |
24 | @Override
25 | public int returnOne() {
26 | return 1;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/cdi/QualifiedPersonRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011-2025 the original author or 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 org.springframework.data.jpa.repository.cdi;
17 |
18 | import org.springframework.data.repository.Repository;
19 |
20 | @PersonDB
21 | public interface QualifiedPersonRepository extends PersonRepository, Repository {
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/cdi/SamplePersonRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014-2025 the original author or 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 | package org.springframework.data.jpa.repository.cdi;
18 |
19 | import org.springframework.data.repository.Repository;
20 |
21 | /**
22 | * @author Mark Paluch
23 | */
24 | public interface SamplePersonRepository extends Repository, SamplePersonRepositoryCustom {}
25 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/cdi/SamplePersonRepositoryCustom.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014-2025 the original author or 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 | package org.springframework.data.jpa.repository.cdi;
18 |
19 | /**
20 | * @author Mark Paluch
21 | */
22 | interface SamplePersonRepositoryCustom {
23 |
24 | int returnOne();
25 | }
26 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/cdi/SamplePersonRepositoryImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014-2025 the original author or 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 | package org.springframework.data.jpa.repository.cdi;
18 |
19 | /**
20 | * @author Mark Paluch
21 | */
22 | class SamplePersonRepositoryImpl implements SamplePersonRepositoryCustom {
23 |
24 | @Override
25 | public int returnOne() {
26 | return 1;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/cdi/Transactional.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011-2025 the original author or 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 org.springframework.data.jpa.repository.cdi;
17 |
18 | import java.lang.annotation.ElementType;
19 | import java.lang.annotation.Retention;
20 | import java.lang.annotation.RetentionPolicy;
21 | import java.lang.annotation.Target;
22 |
23 | import jakarta.interceptor.InterceptorBinding;
24 |
25 | @InterceptorBinding
26 | @Target({ ElementType.METHOD, ElementType.TYPE })
27 | @Retention(RetentionPolicy.RUNTIME)
28 | @interface Transactional {
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/cdi/UnqualifiedEntityManagerProducer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011-2025 the original author or 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 org.springframework.data.jpa.repository.cdi;
17 |
18 | import jakarta.enterprise.inject.Disposes;
19 | import jakarta.enterprise.inject.Produces;
20 | import jakarta.persistence.EntityManager;
21 | import jakarta.persistence.EntityManagerFactory;
22 |
23 | class UnqualifiedEntityManagerProducer {
24 |
25 | @Produces
26 | public EntityManager createEntityManager(EntityManagerFactory entityManagerFactory) {
27 | return entityManagerFactory.createEntityManager();
28 | }
29 |
30 | public void close(@Disposes EntityManager entityManager) {
31 | entityManager.close();
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/cdi/UnqualifiedPersonRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011-2025 the original author or 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 org.springframework.data.jpa.repository.cdi;
17 |
18 | import org.springframework.data.repository.Repository;
19 |
20 | public interface UnqualifiedPersonRepository extends PersonRepository, Repository {
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/cdi/UserDB.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014-2025 the original author or 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 org.springframework.data.jpa.repository.cdi;
17 |
18 | import java.lang.annotation.ElementType;
19 | import java.lang.annotation.Retention;
20 | import java.lang.annotation.RetentionPolicy;
21 | import java.lang.annotation.Target;
22 |
23 | import jakarta.inject.Qualifier;
24 |
25 | /**
26 | * @author Mark Paluch
27 | */
28 | @Qualifier
29 | @Retention(RetentionPolicy.RUNTIME)
30 | @Target({ ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER })
31 | @interface UserDB {
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/config/RepositoryAutoConfigTests.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2008-2025 the original author or 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 org.springframework.data.jpa.repository.config;
17 |
18 | import org.springframework.test.context.ContextConfiguration;
19 |
20 | /**
21 | * Integration test to test repository auto configuration.
22 | *
23 | * @author Oliver Gierke
24 | */
25 | @ContextConfiguration(locations = "classpath:config/namespace-autoconfig-context.xml")
26 | class RepositoryAutoConfigTests extends AbstractRepositoryConfigTests {
27 | }
28 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/config/RepositoryConfigTests.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2008-2025 the original author or 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 org.springframework.data.jpa.repository.config;
17 |
18 | import org.springframework.test.context.ContextConfiguration;
19 |
20 | /**
21 | * Integration test for repository namespace configuration.
22 | *
23 | * @author Oliver Gierke
24 | */
25 | @ContextConfiguration(locations = "classpath:config/namespace-application-context.xml")
26 | class RepositoryConfigTests extends AbstractRepositoryConfigTests {
27 | }
28 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/config/TypeFilterConfigTests.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2008-2025 the original author or 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 org.springframework.data.jpa.repository.config;
17 |
18 | import static org.assertj.core.api.Assertions.*;
19 |
20 | import org.springframework.test.context.ContextConfiguration;
21 |
22 | /**
23 | * Integration test to test {@link org.springframework.core.type.filter.TypeFilter} integration into namespace.
24 | *
25 | * @author Oliver Gierke
26 | * @author Jens Schauder
27 | */
28 | @ContextConfiguration(locations = "classpath:config/namespace-autoconfig-typefilter-context.xml")
29 | class TypeFilterConfigTests extends AbstractRepositoryConfigTests {
30 |
31 | @Override
32 | void testContextCreation() {
33 |
34 | assertThat(userRepository).isNotNull();
35 | assertThat(roleRepository).isNotNull();
36 | assertThat(auditableUserRepository).isNull();
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/config/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Test cases for configuration support classes.
4 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/custom/CustomGenericRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2008-2025 the original author or 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 org.springframework.data.jpa.repository.custom;
17 |
18 | import java.io.Serializable;
19 |
20 | import org.springframework.data.jpa.repository.JpaRepository;
21 | import org.springframework.data.repository.NoRepositoryBean;
22 | import org.springframework.data.repository.CrudRepository;
23 |
24 | /**
25 | * Extension of {@link CrudRepository} to be added on a custom repository base class. This tests the facility to
26 | * implement custom base class functionality for all repository instances derived from this interface and implementation
27 | * base class.
28 | *
29 | * @author Oliver Gierke
30 | */
31 | @NoRepositoryBean
32 | public interface CustomGenericRepository extends JpaRepository {
33 |
34 | T customMethod(ID id);
35 | }
36 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/custom/package-info.java:
--------------------------------------------------------------------------------
1 | @NonNullApi
2 | package org.springframework.data.jpa.repository.custom;
3 |
4 | import org.springframework.lang.NonNullApi;
5 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/generics/EclipseLinkGenericsIntegrationTests.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014-2025 the original author or 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 org.springframework.data.jpa.repository.generics;
17 |
18 | import org.junit.jupiter.api.extension.ExtendWith;
19 | import org.springframework.test.context.ContextConfiguration;
20 | import org.springframework.test.context.junit.jupiter.SpringExtension;
21 | import org.springframework.transaction.annotation.Transactional;
22 |
23 | /**
24 | * @author Yanming Zhou
25 | */
26 | @Transactional
27 | @ExtendWith(SpringExtension.class)
28 | @ContextConfiguration({ "classpath:eclipselink.xml", "classpath:config/namespace-application-context.xml" })
29 | class EclipseLinkGenericsIntegrationTests extends GenericsIntegrationTests {
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/EclipseLinkJpa21UtilsTests.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2025 the original author or 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 org.springframework.data.jpa.repository.query;
17 |
18 | import org.springframework.test.context.ContextConfiguration;
19 |
20 | /**
21 | * @author Christoph Strobl
22 | */
23 | @ContextConfiguration("classpath:eclipselink.xml")
24 | class EclipseLinkJpa21UtilsTests extends Jpa21UtilsTests {}
25 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/EclipseLinkParameterMetadataProviderIntegrationTests.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-2025 the original author or 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 org.springframework.data.jpa.repository.query;
17 |
18 | import org.springframework.test.context.ContextConfiguration;
19 |
20 | /**
21 | * EclipseLink-specific tests for {@link ParameterMetadataProvider}.
22 | *
23 | * @author Oliver Gierke
24 | * @soundtrack Elephants Crossing - We are (Irrelephant)
25 | */
26 | @ContextConfiguration("classpath:eclipselink.xml")
27 | class EclipseLinkParameterMetadataProviderIntegrationTests extends ParameterMetadataProviderIntegrationTests {}
28 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/EscapeCharacterUnitTests.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2025 the original author or 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 org.springframework.data.jpa.repository.query;
17 |
18 | import static org.assertj.core.api.Assertions.*;
19 |
20 | import org.junit.jupiter.api.Test;
21 |
22 | /**
23 | * Unit tests for {@link EscapeCharacter}.
24 | *
25 | * @author Jens Schauder
26 | */
27 | class EscapeCharacterUnitTests {
28 |
29 | @Test // DATAJPA-1522
30 | void nothingToEscape() {
31 | assertThat(EscapeCharacter.of('x').escape("alpha")).isEqualTo("alpha");
32 | }
33 |
34 | @Test // DATAJPA-1522
35 | void wildcardGetsEscaped() {
36 | assertThat(EscapeCharacter.of('x').escape("alp_ha")).isEqualTo("alpx_ha");
37 | }
38 |
39 | @Test // DATAJPA-1522
40 | void escapeCharacterGetsEscaped() {
41 | assertThat(EscapeCharacter.of('x').escape("axlpx_ha")).isEqualTo("axxlpxxx_ha");
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/HqlParserUnitTests.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023-2025 the original author or 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 org.springframework.data.jpa.repository.query;
17 |
18 | import static org.assertj.core.api.Assertions.*;
19 |
20 | import org.junit.jupiter.api.Test;
21 |
22 | /**
23 | * Unit tests to verify that our ANTLR customizations are in place.
24 | *
25 | * @author Mark Paluch
26 | */
27 | class HqlParserUnitTests {
28 |
29 | @Test // GH-3282
30 | void shouldConsiderVisibility() {
31 |
32 | assertThat(HqlParser.class).isPackagePrivate();
33 | assertThat(HqlListener.class).isPackagePrivate();
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/TestEntityQuery.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2025 the original author or 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 org.springframework.data.jpa.repository.query;
17 |
18 | /**
19 | * Test-variant of {@link DefaultEntityQuery} with a simpler constructor.
20 | *
21 | * @author Mark Paluch
22 | */
23 | class TestEntityQuery extends DefaultEntityQuery {
24 |
25 | /**
26 | * Creates a new {@link DefaultEntityQuery} from the given JPQL query.
27 | *
28 | * @param query must not be {@literal null} or empty.
29 | */
30 | TestEntityQuery(String query, boolean isNative) {
31 |
32 | super(PreprocessedQuery.parse(isNative ? DeclaredQuery.nativeQuery(query) : DeclaredQuery.jpqlQuery(query)),
33 | QueryEnhancerSelector.DEFAULT_SELECTOR
34 | .select(isNative ? DeclaredQuery.nativeQuery(query) : DeclaredQuery.jpqlQuery(query)));
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/sample/AnnotatedAuditableUserRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014-2025 the original author or 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 org.springframework.data.jpa.repository.sample;
17 |
18 | import org.springframework.context.annotation.Lazy;
19 | import org.springframework.data.jpa.domain.sample.AnnotatedAuditableUser;
20 | import org.springframework.data.repository.CrudRepository;
21 |
22 | /**
23 | * Repository interface for {@code AuditableUser}.
24 | *
25 | * @author Oliver Gierke
26 | */
27 | @Lazy
28 | public interface AnnotatedAuditableUserRepository extends CrudRepository {
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/sample/AuditableEntityRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2008-2025 the original author or 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 org.springframework.data.jpa.repository.sample;
17 |
18 | import org.springframework.data.jpa.domain.sample.AuditableEntity;
19 | import org.springframework.data.jpa.repository.JpaRepository;
20 |
21 | /**
22 | * {@link JpaRepository} to test {@link org.springframework.data.jpa.domain.support.AuditingEntityListener}.
23 | */
24 | public interface AuditableEntityRepository extends JpaRepository {}
25 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/sample/BookRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014-2025 the original author or 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 org.springframework.data.jpa.repository.sample;
17 |
18 | import org.springframework.data.jpa.domain.sample.Book;
19 | import org.springframework.data.jpa.repository.JpaRepository;
20 |
21 | import java.util.List;
22 |
23 | /**
24 | * @author Yanming Zhou
25 | */
26 | public interface BookRepository extends JpaRepository {
27 |
28 | List findAllByOwnerName(String ownerName);
29 | }
30 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/sample/CategoryRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014-2025 the original author or 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 org.springframework.data.jpa.repository.sample;
17 |
18 | import org.springframework.data.jpa.domain.sample.Category;
19 | import org.springframework.data.repository.CrudRepository;
20 |
21 | /**
22 | * @author Oliver Gierke
23 | */
24 | public interface CategoryRepository extends CrudRepository {}
25 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/sample/ClassWithNestedRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013-2025 the original author or 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 org.springframework.data.jpa.repository.sample;
17 |
18 | import org.springframework.data.jpa.domain.sample.User;
19 | import org.springframework.data.repository.Repository;
20 |
21 | /**
22 | * @author Thomas Darimont
23 | * @author Oliver Gierke
24 | */
25 | public class ClassWithNestedRepository {
26 |
27 | public static interface NestedUserRepository extends Repository {}
28 | }
29 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/sample/ConcreteRepository1.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013-2025 the original author or 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 org.springframework.data.jpa.repository.sample;
17 |
18 | import org.springframework.context.annotation.Lazy;
19 | import org.springframework.data.jpa.domain.sample.ConcreteType1;
20 |
21 | /**
22 | * @author Thomas Darimont
23 | */
24 | @Lazy
25 | public interface ConcreteRepository1 extends MappedTypeRepository {
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/sample/ConcreteRepository2.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013-2025 the original author or 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 org.springframework.data.jpa.repository.sample;
17 |
18 | import org.springframework.context.annotation.Lazy;
19 | import org.springframework.data.jpa.domain.sample.ConcreteType2;
20 |
21 | /**
22 | * @author Thomas Darimont
23 | */
24 | @Lazy
25 | public interface ConcreteRepository2 extends MappedTypeRepository {
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/sample/CustomAbstractPersistableRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014-2025 the original author or 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 org.springframework.data.jpa.repository.sample;
17 |
18 | import org.springframework.data.jpa.domain.sample.CustomAbstractPersistable;
19 | import org.springframework.data.jpa.repository.JpaRepository;
20 |
21 | /**
22 | * @author Thomas Darimont
23 | * @author Oliver Gierke
24 | */
25 | public interface CustomAbstractPersistableRepository extends JpaRepository {}
26 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/sample/EntityWithAssignedIdRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2025 the original author or 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 org.springframework.data.jpa.repository.sample;
17 |
18 | import java.util.UUID;
19 |
20 | import org.springframework.data.jpa.domain.sample.EntityWithAssignedId;
21 | import org.springframework.data.repository.CrudRepository;
22 |
23 | /**
24 | * @author Oliver Drotbohm
25 | */
26 | public interface EntityWithAssignedIdRepository extends CrudRepository {
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/sample/ItemRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016-2025 the original author or 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 org.springframework.data.jpa.repository.sample;
17 |
18 | import org.springframework.data.jpa.domain.sample.Item;
19 | import org.springframework.data.jpa.domain.sample.ItemId;
20 | import org.springframework.data.jpa.repository.JpaRepository;
21 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
22 |
23 | /**
24 | * @author Mark Paluch
25 | * @author Aleksei Elin
26 | * @see Jakarta
27 | * Persistence Specification: Derived Identities, Example 2
28 | */
29 | public interface ItemRepository extends JpaRepository- , JpaSpecificationExecutor
- {}
30 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/sample/ItemSiteRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016-2025 the original author or 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 org.springframework.data.jpa.repository.sample;
17 |
18 | import org.springframework.data.jpa.domain.sample.ItemSite;
19 | import org.springframework.data.jpa.domain.sample.ItemSiteId;
20 | import org.springframework.data.jpa.repository.JpaRepository;
21 |
22 | /**
23 | * @author Mark Paluch
24 | * @author Aleksei Elin
25 | * @see Jakarta
26 | * Persistence Specification: Derived Identities, Example 2
27 | */
28 | public interface ItemSiteRepository extends JpaRepository {}
29 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/sample/MailMessageRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013-2025 the original author or 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 org.springframework.data.jpa.repository.sample;
17 |
18 | import java.util.List;
19 |
20 | import org.springframework.data.jpa.domain.sample.MailMessage;
21 | import org.springframework.data.jpa.repository.JpaRepository;
22 | import org.springframework.data.querydsl.QuerydslPredicateExecutor;
23 |
24 | import com.querydsl.core.types.OrderSpecifier;
25 | import com.querydsl.core.types.Predicate;
26 |
27 | /**
28 | * @author Thomas Darimont
29 | */
30 | public interface MailMessageRepository
31 | extends JpaRepository, QuerydslPredicateExecutor {
32 |
33 | @Override
34 | List findAll(Predicate predicate, OrderSpecifier>... orders);
35 | }
36 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/sample/NameOnlyDto.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-2025 the original author or 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 org.springframework.data.jpa.repository.sample;
17 |
18 | // DATAJPA-1334
19 | public class NameOnlyDto {
20 |
21 | private String firstname;
22 | private String lastname;
23 |
24 | public NameOnlyDto(String firstname, String lastname) {
25 | this.firstname = firstname;
26 | this.lastname = lastname;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/sample/NameOnlyRecord.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-2025 the original author or 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 org.springframework.data.jpa.repository.sample;
17 |
18 | public record NameOnlyRecord(String firstname, String lastname) {
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/sample/ParentRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013-2025 the original author or 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 org.springframework.data.jpa.repository.sample;
17 |
18 | import org.springframework.context.annotation.Lazy;
19 | import org.springframework.data.jpa.domain.sample.Parent;
20 | import org.springframework.data.jpa.repository.JpaRepository;
21 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
22 |
23 | @Lazy
24 | public interface ParentRepository extends JpaRepository, JpaSpecificationExecutor {}
25 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/sample/ProductRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014-2025 the original author or 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 org.springframework.data.jpa.repository.sample;
17 |
18 | import org.springframework.data.jpa.domain.sample.Product;
19 | import org.springframework.data.jpa.repository.JpaRepository;
20 |
21 | /**
22 | * @author Oliver Gierke
23 | */
24 | public interface ProductRepository extends JpaRepository {
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/sample/SampleConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013-2025 the original author or 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 org.springframework.data.jpa.repository.sample;
17 |
18 | import org.springframework.context.annotation.Configuration;
19 | import org.springframework.context.annotation.ImportResource;
20 | import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
21 |
22 | /**
23 | * @author Oliver Gierke
24 | */
25 | @Configuration
26 | @ImportResource("classpath:infrastructure.xml")
27 | @EnableJpaRepositories
28 | public class SampleConfig {
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/sample/SiteRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016-2025 the original author or 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 org.springframework.data.jpa.repository.sample;
17 |
18 | import org.springframework.data.jpa.domain.sample.Site;
19 | import org.springframework.data.jpa.repository.JpaRepository;
20 |
21 | /**
22 | * @author Mark Paluch
23 | * @author Aleksei Elin
24 | * @see Jakarta
25 | * Persistence Specification: Derived Identities, Example 2
26 | */
27 | public interface SiteRepository extends JpaRepository {}
28 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/sample/UserRepositoryCustom.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2008-2025 the original author or 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 org.springframework.data.jpa.repository.sample;
17 |
18 | import org.springframework.data.jpa.domain.sample.User;
19 |
20 | /**
21 | * Simple interface for custom methods on the repository for {@code User}s.
22 | *
23 | * @author Oliver Gierke
24 | */
25 | public interface UserRepositoryCustom {
26 |
27 | /**
28 | * Method actually triggering a finder but being overridden.
29 | */
30 | void findByOverrridingMethod();
31 |
32 | /**
33 | * Some custom method to implement.
34 | */
35 | void someCustomMethod(User user);
36 | }
37 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/support/EclipseLinkJpaRepositoryTests.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013-2025 the original author or 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 org.springframework.data.jpa.repository.support;
17 |
18 | import org.junit.jupiter.api.Disabled;
19 | import org.springframework.test.context.ContextConfiguration;
20 |
21 | /**
22 | * Integration tests to execute {@link JpaRepositoryTests} against EclipseLink.
23 | *
24 | * @author Oliver Gierke
25 | * @author Greg Turnquist
26 | */
27 | @ContextConfiguration("classpath:eclipselink.xml")
28 | class EclipseLinkJpaRepositoryTests extends JpaRepositoryTests {
29 |
30 | @Override
31 | @Disabled("https://bugs.eclipse.org/bugs/show_bug.cgi?id=349477")
32 | void deleteAllByIdInBatch() {
33 | // disabled
34 | }
35 |
36 | @Override
37 | @Disabled("https://bugs.eclipse.org/bugs/show_bug.cgi?id=349477")
38 | void deleteAllByIdInBatchShouldConvertAnIterableToACollection() {
39 | // disabled
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/support/QSimpleEntityPathResolverUnitTests_Sample.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011-2025 the original author or 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 org.springframework.data.jpa.repository.support;
17 |
18 | /**
19 | * Stub for a generated QueryDsl query class.
20 | *
21 | * @author Oliver Gierke
22 | */
23 | class QSimpleEntityPathResolverUnitTests_Sample {
24 |
25 | public QSimpleEntityPathResolverUnitTests_Sample field;
26 | }
27 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/support/XmlConfigDefaultTransactionDisablingIntegrationTests.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-2025 the original author or 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 org.springframework.data.jpa.repository.support;
17 |
18 | import org.springframework.test.context.ContextConfiguration;
19 |
20 | /**
21 | * Integration tests for disabled default configurations via XML configuration.
22 | *
23 | * @author Oliver Gierke
24 | * @soundtrack The Intersphere - Live in Mannheim
25 | */
26 | @ContextConfiguration("disable-default-transactions.xml")
27 | class XmlConfigDefaultTransactionDisablingIntegrationTests extends DefaultTransactionDisablingIntegrationTests {}
28 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/support/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Test cases for ORM DAO implementations.
4 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/java/org/springframework/data/jpa/util/FixedDate.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-2025 the original author or 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 org.springframework.data.jpa.util;
17 |
18 | import java.time.Instant;
19 |
20 | /**
21 | * Holds a fixed {@link Instant} value to use in components that have no direct connection.
22 | *
23 | * @author Thomas Darimont
24 | * @author Christoph Strobl
25 | */
26 | public enum FixedDate {
27 |
28 | INSTANCE;
29 |
30 | private Instant fixedDate;
31 |
32 | public void setDate(Instant date) {
33 | this.fixedDate = date;
34 | }
35 |
36 | public Instant getDate() {
37 | return fixedDate;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/resources/META-INF/jpa-named-queries.properties:
--------------------------------------------------------------------------------
1 | User.findBySpringDataNamedQuery=select u from User u where u.lastname=?1
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/resources/META-INF/orm.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
10 |
12 |
13 |
14 |
15 |
16 |
17 | SELECT u FROM User u WHERE u.lastname = ?1
18 |
19 |
20 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/resources/META-INF/persistence-jmh.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
21 |
22 | org.hibernate.jpa.HibernatePersistenceProvider
23 | org.springframework.data.jpa.domain.AbstractPersistable
24 | org.springframework.data.jpa.domain.AbstractAuditable
25 | org.springframework.data.jpa.benchmark.model.Person
26 | org.springframework.data.jpa.benchmark.model.Profile
27 | true
28 |
29 |
30 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/resources/auditing/auditing-bfpp-context.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/resources/auditing/auditing-entity-listener.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/resources/auditing/auditing-entity-with-embeddable-listener.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/resources/auditing/auditing-namespace-context.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/resources/auditing/auditing-namespace-context2.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/resources/auditing/auditing-namespace-context3.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/resources/config/lookup-strategies-context.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/resources/config/namespace-application-context-h2.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/resources/config/namespace-autoconfig-context.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/resources/config/namespace-autoconfig-typefilter-context.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/resources/config/namespace-customfactory-context.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/resources/config/namespace-nested-repositories-application-context.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/resources/eclipselink-h2.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
12 | org.h2.Driver
13 | jdbc:h2:mem:hades
14 | sa
15 |
16 | create-tables
17 | false
18 | SEVERE
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/resources/eclipselink.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
12 | org.hsqldb.jdbcDriver
13 | jdbc:hsqldb:mem:hades
14 | sa
15 |
16 | create-tables
17 | false
18 | SEVERE
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/resources/hibernate.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/resources/logback.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | %d %5p %40.40c:%4L - %m%n
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/resources/org/springframework/data/jpa/repository/support/disable-default-transactions.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/resources/org/springframework/data/jpa/support/mapping.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/resources/org/springframework/data/jpa/support/module1/module1-orm.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/resources/org/springframework/data/jpa/support/module2/module2-orm.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/resources/org/springframework/data/jpa/support/persistence.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | foo.xml
8 | org.springframework.data.jpa.domain.sample.User
9 |
10 |
11 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/resources/org/springframework/data/jpa/support/persistence2.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | bar.xml
8 | org.springframework.data.jpa.domain.sample.Role
9 |
10 |
11 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/resources/scripts/h2-init.sql:
--------------------------------------------------------------------------------
1 | ;
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/resources/scripts/h2-stored-procedures.sql:
--------------------------------------------------------------------------------
1 | /;
2 | DROP alias IF EXISTS plus1inout
3 | /;
4 | CREATE alias plus1inout AS $$
5 | Integer plus1inout(Integer arg) {
6 | return arg + 1;
7 | }
8 | $$
9 | /;
10 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/resources/scripts/hsqldb-init.sql:
--------------------------------------------------------------------------------
1 | /;
2 | SET DATABASE SQL SYNTAX ORA TRUE
3 | /;
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/resources/scripts/mysql-stored-procedures.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE employee
2 | (
3 | ID int NOT NULL,
4 | name varchar(50) NOT NULL,
5 | primary key (ID)
6 | );;
7 |
8 | INSERT INTO employee (ID, NAME) VALUES (3, 'Fanny');;
9 | INSERT INTO employee (ID, NAME) VALUES (4, 'Gabriel');;
10 |
11 | DROP PROCEDURE IF EXISTS get_employees;;
12 | CREATE PROCEDURE get_employees()
13 | BEGIN
14 | SELECT * FROM employee;
15 | END;;
16 |
17 | DROP PROCEDURE IF EXISTS get_employees_count;;
18 | CREATE PROCEDURE get_employees_count(OUT employees INT)
19 | BEGIN
20 | SELECT COUNT(*) into employees FROM employee;
21 | END;;
22 |
23 | DROP PROCEDURE IF EXISTS get_single_employee;;
24 | CREATE PROCEDURE get_single_employee()
25 | BEGIN
26 | SELECT * FROM employee WHERE employee.ID = 3;
27 | END;;
28 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/resources/scripts/oracle-vector-initialize.sql:
--------------------------------------------------------------------------------
1 | -- Exit on any errors
2 | WHENEVER SQLERROR EXIT SQL.SQLCODE
3 |
4 | -- Configure the size of the Vector Pool to 1 GiB.
5 | ALTER SYSTEM SET vector_memory_size = 1G SCOPE=SPFILE;
6 |
7 | SHUTDOWN
8 | ABORT;
9 | STARTUP;
10 |
11 | exit;
12 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/resources/scripts/oracle-vector.sql:
--------------------------------------------------------------------------------
1 | DROP TABLE IF EXISTS with_vector;;
2 |
3 | CREATE TABLE IF NOT EXISTS with_vector
4 | (
5 | id NUMBER GENERATED BY DEFAULT ON NULL AS IDENTITY,
6 | country varchar2(10),
7 | description varchar2(10),
8 | distance varchar2(10),
9 | the_embedding vector(5, FLOAT32) annotations(Distance 'COSINE', IndexType 'IVF')
10 | );;
11 |
12 | create
13 | vector index if not exists vector_index_1 on with_vector (the_embedding)
14 | organization neighbor partitions
15 | distance COSINE
16 | with target accuracy 95
17 | parameters (type IVF, neighbor partitions 10);;
18 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/resources/scripts/pgvector.sql:
--------------------------------------------------------------------------------
1 | CREATE EXTENSION IF NOT EXISTS vector;
2 |
3 | DROP TABLE IF EXISTS with_vector;
4 |
5 | CREATE TABLE IF NOT EXISTS with_vector (id bigserial PRIMARY KEY,country varchar(10), description varchar(10), distance varchar(10), the_embedding vector(5));
6 |
7 | CREATE INDEX ON with_vector USING hnsw (the_embedding vector_l2_ops);
8 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/resources/scripts/postgres-nullable-stored-procedures.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE test_model
2 | (
3 | ID numeric NOT NULL,
4 | uuid UUID,
5 | local_date DATE,
6 | CONSTRAINT test_model_pk PRIMARY KEY (ID)
7 | );;
8 |
9 | CREATE OR REPLACE PROCEDURE countByUuid(IN this_uuid uuid)
10 | LANGUAGE 'plpgsql'
11 | AS
12 | $BODY$
13 | DECLARE
14 | c integer;
15 | BEGIN
16 | SELECT count(*)
17 | INTO c
18 | FROM test_model
19 | WHERE test_model.uuid = this_uuid;
20 | END;
21 | $BODY$
22 | ;;
23 |
24 | CREATE OR REPLACE PROCEDURE countByLocalDate(IN this_local_date DATE)
25 | LANGUAGE 'plpgsql'
26 | AS
27 | $BODY$
28 | DECLARE
29 | c integer;
30 | BEGIN
31 | SELECT count(*)
32 | INTO c
33 | FROM test_model
34 | WHERE test_model.local_date = this_local_date;
35 | END;
36 | $BODY$
37 | ;;
38 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/resources/simple-persistence/simple-persistence.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 | true
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/spring-data-jpa/src/test/resources/tx-manager.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/src/main/antora/antora-playbook.yml:
--------------------------------------------------------------------------------
1 | # PACKAGES antora@3.2.0-alpha.2 @antora/atlas-extension:1.0.0-alpha.1 @antora/collector-extension@1.0.0-alpha.3 @springio/antora-extensions@1.1.0-alpha.2 @asciidoctor/tabs@1.0.0-alpha.12 @opendevise/antora-release-line-extension@1.0.0-alpha.2
2 | #
3 | # The purpose of this Antora playbook is to build the docs in the current branch.
4 | antora:
5 | extensions:
6 | - require: '@springio/antora-extensions'
7 | root_component_name: 'data-jpa'
8 | site:
9 | title: Spring Data JPA
10 | url: https://docs.spring.io/spring-data/jpa/reference
11 | content:
12 | sources:
13 | - url: ./../../..
14 | branches: HEAD
15 | start_path: src/main/antora
16 | worktrees: true
17 | - url: https://github.com/spring-projects/spring-data-commons
18 | # Refname matching:
19 | # https://docs.antora.org/antora/latest/playbook/content-refname-matching/
20 | branches: [ 4.0.x ]
21 | start_path: src/main/antora
22 | asciidoc:
23 | attributes:
24 | hide-uri-scheme: '@'
25 | tabs-sync-option: '@'
26 | extensions:
27 | - '@asciidoctor/tabs'
28 | - '@springio/asciidoctor-extensions'
29 | - '@springio/asciidoctor-extensions/javadoc-extension'
30 | sourcemap: true
31 | urls:
32 | latest_version_segment: ''
33 | runtime:
34 | log:
35 | failure_level: warn
36 | format: pretty
37 | ui:
38 | bundle:
39 | url: https://github.com/spring-io/antora-ui-spring/releases/download/v0.4.16/ui-bundle.zip
40 | snapshot: true
41 |
--------------------------------------------------------------------------------
/src/main/antora/antora.yml:
--------------------------------------------------------------------------------
1 | name: data-jpa
2 | version: true
3 | title: Spring Data JPA
4 | nav:
5 | - modules/ROOT/nav.adoc
6 | ext:
7 | collector:
8 | - run:
9 | command: ./mvnw test-compile -Pantora-process-resources
10 | local: true
11 | scan:
12 | dir: spring-data-jpa-distribution/target/classes
13 | - run:
14 | command: ./mvnw package -Pdistribute
15 | local: true
16 | scan:
17 | dir: target/antora
18 |
--------------------------------------------------------------------------------
/src/main/antora/modules/ROOT/nav.adoc:
--------------------------------------------------------------------------------
1 | * xref:index.adoc[Overview]
2 | ** xref:commons/upgrade.adoc[]
3 |
4 | * xref:jpa.adoc[]
5 | ** xref:jpa/getting-started.adoc[]
6 | ** xref:repositories/core-concepts.adoc[]
7 | ** xref:repositories/definition.adoc[]
8 | ** xref:repositories/create-instances.adoc[]
9 | ** xref:jpa/entity-persistence.adoc[]
10 | ** xref:repositories/query-methods-details.adoc[]
11 | ** xref:jpa/query-methods.adoc[]
12 | ** xref:jpa/value-expressions.adoc[]
13 | ** xref:repositories/projections.adoc[]
14 | ** xref:jpa/stored-procedures.adoc[]
15 | ** xref:jpa/specifications.adoc[]
16 | ** xref:repositories/query-by-example.adoc[]
17 | ** xref:repositories/vector-search.adoc[]
18 | ** xref:jpa/transactions.adoc[]
19 | ** xref:jpa/locking.adoc[]
20 | ** xref:auditing.adoc[]
21 | ** xref:jpa/misc-merging-persistence-units.adoc[]
22 | ** xref:jpa/jpd-misc-cdi-integration.adoc[]
23 | ** xref:repositories/custom-implementations.adoc[]
24 | ** xref:repositories/core-domain-events.adoc[]
25 | ** xref:repositories/null-handling.adoc[]
26 | ** xref:repositories/core-extensions.adoc[]
27 | ** xref:repositories/query-keywords-reference.adoc[]
28 | ** xref:repositories/query-return-types-reference.adoc[]
29 | ** xref:jpa/aot.adoc[]
30 | ** xref:jpa/faq.adoc[]
31 | ** xref:jpa/glossary.adoc[]
32 |
33 | * xref:envers.adoc[]
34 | ** xref:envers/introduction.adoc[]
35 | ** xref:envers/configuration.adoc[]
36 | ** xref:envers/usage.adoc[]
37 |
38 | * xref:attachment$api/java/index.html[Javadoc,role=link-external, window=_blank]
39 | * https://github.com/spring-projects/spring-data-commons/wiki[Wiki,role=link-external, window=_blank]
40 |
--------------------------------------------------------------------------------
/src/main/antora/modules/ROOT/pages/commons/upgrade.adoc:
--------------------------------------------------------------------------------
1 | include::{commons}@data-commons::page$upgrade.adoc[]
2 |
--------------------------------------------------------------------------------
/src/main/antora/modules/ROOT/pages/envers.adoc:
--------------------------------------------------------------------------------
1 | [[envers]]
2 | = Envers
3 | :page-section-summary-toc: 1
4 |
5 | This chapter points out the specialties for repository support for Envers. This builds on the core repository support explained earlier. Make sure you have a sound understanding of the basic concepts explained there.
6 |
--------------------------------------------------------------------------------
/src/main/antora/modules/ROOT/pages/envers/introduction.adoc:
--------------------------------------------------------------------------------
1 | [[envers.introduction]]
2 | = Introduction
3 |
4 | [[envers.what.is.spring.data]]
5 | == What is Spring Data Envers?
6 |
7 | Spring Data Envers makes typical Envers queries available in repositories for Spring Data JPA.
8 | It differs from other Spring Data modules in that it is always used in combination with another Spring Data Module: Spring Data JPA.
9 |
10 | [[envers.what]]
11 | == What is Envers?
12 |
13 | Envers is a https://hibernate.org/orm/envers/[Hibernate module] that adds auditing capabilities to JPA entities.
14 | This documentation assumes you are familiar with Envers, just as Spring Data Envers relies on Envers being properly configured.
15 |
--------------------------------------------------------------------------------
/src/main/antora/modules/ROOT/pages/index.adoc:
--------------------------------------------------------------------------------
1 | [[spring-data-jpa-reference-documentation]]
2 | = Spring Data JPA
3 | :revnumber: {version}
4 | :revdate: {localdate}
5 |
6 | _Spring Data JPA provides repository support for the Jakarta Persistence API (JPA).
7 | It eases development of applications with a consistent programming model that need to access JPA data sources._
8 |
9 | [horizontal]
10 | xref:jpa.adoc[JPA] :: JPA and JPA Repositories
11 | xref:envers.adoc[Envers] :: Support for Envers Revision Repositories
12 | https://github.com/spring-projects/spring-data-commons/wiki[Wiki] :: What's New,
13 | Upgrade Notes, Supported Versions, additional cross-version information.
14 |
15 | Oliver Gierke, Thomas Darimont, Christoph Strobl, Mark Paluch, Jay Bryant, Greg Turnquist
16 |
17 | (C) 2008-{copyright-year} VMware, Inc.
18 |
19 | Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether distributed in print or electronically.
20 |
21 |
--------------------------------------------------------------------------------
/src/main/antora/modules/ROOT/pages/jpa.adoc:
--------------------------------------------------------------------------------
1 | [[jpa.repositories]]
2 | = JPA
3 | :page-section-summary-toc: 1
4 |
5 | This chapter points out the specialties for repository support for JPA. This builds on the core repository support explained in xref:repositories.adoc[Working with Spring Data Repositories]. Make sure you have a sound understanding of the basic concepts explained there.
6 |
7 |
--------------------------------------------------------------------------------
/src/main/antora/modules/ROOT/pages/jpa/faq.adoc:
--------------------------------------------------------------------------------
1 | [[faq]]
2 | [appendix]
3 | [[frequently-asked-questions]]
4 | = Frequently Asked Questions
5 |
6 | [[faq.common]]
7 | == Common
8 |
9 | [qanda]
10 | I'd like to get more detailed logging information on what methods are called inside `JpaRepository` for example. How can I gain them? :: You can make use of `CustomizableTraceInterceptor` provided by Spring, as shown in the following example:
11 | +
12 | [source, xml]
13 | ----
14 |
16 |
17 |
18 |
19 |
20 |
21 |
23 |
24 | ----
25 |
26 | [[faq.auditing]]
27 | == Auditing
28 |
29 | [qanda]
30 | I want to use Spring Data JPA auditing capabilities but have my database already configured to set modification and creation date on entities. How can I prevent Spring Data from setting the date programmatically? :: Set the `set-dates` attribute of the `auditing` namespace element to `false`.
31 |
--------------------------------------------------------------------------------
/src/main/antora/modules/ROOT/pages/jpa/glossary.adoc:
--------------------------------------------------------------------------------
1 | [[glossary]]
2 | [appendix, glossary]
3 | [[glossary]]
4 | = Glossary
5 | :page-section-summary-toc: 1
6 |
7 | AOP :: Aspect oriented programming
8 |
9 | Commons DBCP :: Commons DataBase Connection Pools - a library from the Apache foundation that offers pooling implementations of the DataSource interface.
10 |
11 | CRUD :: Create, Read, Update, Delete - Basic persistence operations.
12 |
13 | DAO :: Data Access Object - Pattern to separate persisting logic from the object to be persisted
14 |
15 | Dependency Injection :: Pattern to hand a component's dependency to the component from outside, freeing the component to lookup the dependent itself. For more information, see link:$$https://en.wikipedia.org/wiki/Dependency_Injection$$[https://en.wikipedia.org/wiki/Dependency_Injection].
16 |
17 | EclipseLink :: Object relational mapper implementing JPA - link:$$https://www.eclipse.org/eclipselink/$$[https://www.eclipse.org/eclipselink/]
18 |
19 | Hibernate :: Object relational mapper implementing JPA - link:$$https://hibernate.org/$$[https://hibernate.org/]
20 |
21 | JPA :: Jakarta Persistence API
22 |
23 | Spring :: Java application framework - link:$$https://spring.io/projects/spring-framework/$$[https://spring.io/projects/spring-framework]
24 |
--------------------------------------------------------------------------------
/src/main/antora/modules/ROOT/pages/jpa/locking.adoc:
--------------------------------------------------------------------------------
1 | [[locking]]
2 | = Locking
3 |
4 | To specify the lock mode to be used, you can use the `@Lock` annotation on query methods, as shown in the following example:
5 |
6 | .Defining lock metadata on query methods
7 | ====
8 | [source, java]
9 | ----
10 | interface UserRepository extends Repository {
11 |
12 | // Plain query method
13 | @Lock(LockModeType.READ)
14 | List findByLastname(String lastname);
15 | }
16 | ----
17 | ====
18 |
19 | This method declaration causes the query being triggered to be equipped with a `LockModeType` of `READ`. You can also define locking for CRUD methods by redeclaring them in your repository interface and adding the `@Lock` annotation, as shown in the following example:
20 |
21 | .Defining lock metadata on CRUD methods
22 | ====
23 | [source, java]
24 | ----
25 | interface UserRepository extends Repository {
26 |
27 | // Redeclaration of a CRUD method
28 | @Lock(LockModeType.READ)
29 | List findAll();
30 | }
31 | ----
32 | ====
33 |
--------------------------------------------------------------------------------
/src/main/antora/modules/ROOT/pages/jpa/value-expressions.adoc:
--------------------------------------------------------------------------------
1 | include::{commons}@data-commons::page$value-expressions.adoc[]
2 |
--------------------------------------------------------------------------------
/src/main/antora/modules/ROOT/pages/repositories.adoc:
--------------------------------------------------------------------------------
1 | [[common.basics]]
2 | = Introduction
3 | :page-section-summary-toc: 1
4 |
5 | This chapter explains the basic foundations of Spring Data repositories. Before continuing to the JPA specifics, make sure you have a sound understanding of the basic concepts explained here.
6 |
7 | The goal of the Spring Data repository abstraction is to significantly reduce the amount of boilerplate code required to implement data access layers for various persistence stores.
8 |
--------------------------------------------------------------------------------
/src/main/antora/modules/ROOT/pages/repositories/core-concepts.adoc:
--------------------------------------------------------------------------------
1 | include::{commons}@data-commons::page$repositories/core-concepts.adoc[]
2 |
--------------------------------------------------------------------------------
/src/main/antora/modules/ROOT/pages/repositories/core-domain-events.adoc:
--------------------------------------------------------------------------------
1 | include::{commons}@data-commons::page$repositories/core-domain-events.adoc[]
2 |
--------------------------------------------------------------------------------
/src/main/antora/modules/ROOT/pages/repositories/custom-implementations.adoc:
--------------------------------------------------------------------------------
1 | include::{commons}@data-commons::page$repositories/custom-implementations.adoc[]
2 |
3 | [[jpa.misc.jpa-context]]
4 | == Using `JpaContext` in Custom Implementations
5 |
6 | When working with multiple `EntityManager` instances and xref:repositories/custom-implementations.adoc#repositories.custom-implementations[custom repository implementations], you need to wire the correct `EntityManager` into the repository implementation class. You can do so by explicitly naming the `EntityManager` in the `@PersistenceContext` annotation or, if the `EntityManager` is `@Autowired`, by using `@Qualifier`.
7 |
8 | As of Spring Data JPA 1.9, Spring Data JPA includes a class called `JpaContext` that lets you obtain the `EntityManager` by managed domain class, assuming it is managed by only one of the `EntityManager` instances in the application. The following example shows how to use `JpaContext` in a custom repository:
9 |
10 | .Using `JpaContext` in a custom repository implementation
11 | ====
12 | [source, java]
13 | ----
14 | class UserRepositoryImpl implements UserRepositoryCustom {
15 |
16 | private final EntityManager em;
17 |
18 | @Autowired
19 | public UserRepositoryImpl(JpaContext context) {
20 | this.em = context.getEntityManagerByManagedType(User.class);
21 | }
22 |
23 | …
24 | }
25 | ----
26 | ====
27 |
28 | The advantage of this approach is that, if the domain type gets assigned to a different persistence unit, the repository does not have to be touched to alter the reference to the persistence unit.
29 |
30 |
--------------------------------------------------------------------------------
/src/main/antora/modules/ROOT/pages/repositories/definition.adoc:
--------------------------------------------------------------------------------
1 | include::{commons}@data-commons::page$repositories/definition.adoc[]
2 |
--------------------------------------------------------------------------------
/src/main/antora/modules/ROOT/pages/repositories/null-handling.adoc:
--------------------------------------------------------------------------------
1 | include::{commons}@data-commons::page$repositories/null-handling.adoc[]
2 |
--------------------------------------------------------------------------------
/src/main/antora/modules/ROOT/pages/repositories/query-keywords-reference.adoc:
--------------------------------------------------------------------------------
1 | include::{commons}@data-commons::page$repositories/query-keywords-reference.adoc[]
2 |
--------------------------------------------------------------------------------
/src/main/antora/modules/ROOT/pages/repositories/query-methods-details.adoc:
--------------------------------------------------------------------------------
1 | :feature-scroll:
2 | include::{commons}@data-commons::page$repositories/query-methods-details.adoc[]
3 |
--------------------------------------------------------------------------------
/src/main/antora/modules/ROOT/pages/repositories/query-return-types-reference.adoc:
--------------------------------------------------------------------------------
1 | include::{commons}@data-commons::page$repositories/query-return-types-reference.adoc[]
2 |
--------------------------------------------------------------------------------
/src/main/antora/modules/ROOT/pages/repositories/vector-search.adoc:
--------------------------------------------------------------------------------
1 | :vector-search-intro-include: partial$vector-search-intro-include.adoc
2 | :vector-search-model-include: partial$vector-search-model-include.adoc
3 | :vector-search-repository-include: partial$vector-search-repository-include.adoc
4 | :vector-search-scoring-include: partial$vector-search-scoring-include.adoc
5 | :vector-search-method-derived-include: partial$vector-search-method-derived-include.adoc
6 | :vector-search-method-annotated-include: partial$vector-search-method-annotated-include.adoc
7 |
8 | include::partial$vector-search.adoc[]
9 |
--------------------------------------------------------------------------------
/src/main/antora/modules/ROOT/partials/vector-search-intro-include.adoc:
--------------------------------------------------------------------------------
1 | To use Hibernate Vector Search, you need to add the following dependencies to your project.
2 |
3 | The following example shows how to set up dependencies in Maven and Gradle:
4 |
5 | [tabs]
6 | ======
7 | Maven::
8 | +
9 | [source,xml,indent=0,subs="verbatim,quotes",role="primary"]
10 | ----
11 |
12 |
13 | org.hibernate.orm
14 | hibernate-vector
15 | ${hibernate.version}
16 |
17 |
18 | ----
19 |
20 | Gradle::
21 | +
22 | ====
23 | [source,groovy,indent=0,subs="verbatim,quotes",role="secondary"]
24 | ----
25 | dependencies {
26 | implementation 'org.hibernate.orm:hibernate-vector:${hibernateVersion}'
27 | }
28 | ----
29 | ====
30 | ======
31 |
32 | NOTE: While you can use `Vector` as type for queries, you cannot use it in your domain model as Hibernate requires float or double arrays as vector types.
33 |
--------------------------------------------------------------------------------
/src/main/antora/modules/ROOT/partials/vector-search-method-annotated-include.adoc:
--------------------------------------------------------------------------------
1 | Annotated search methods must define the entire JPQL query to run a Vector Search.
2 |
3 | .Using `@Query` Search Methods
4 | ====
5 | [source,java]
6 | ----
7 | interface CommentRepository extends Repository {
8 |
9 | @Query("""
10 | SELECT c, cosine_distance(c.embedding, :embedding) as distance FROM Comment c
11 | WHERE c.country = ?1
12 | AND cosine_distance(c.embedding, :embedding) <= :distance
13 | ORDER BY distance asc""")
14 | SearchResults searchAnnotatedByCountryAndEmbeddingWithin(String country, Vector embedding,
15 | Score distance);
16 |
17 | @Query("""
18 | SELECT c FROM Comment c
19 | WHERE c.country = ?1
20 | AND cosine_distance(c.embedding, :embedding) <= :distance
21 | ORDER BY cosine_distance(c.embedding, :embedding) asc""")
22 | List findAnnotatedByCountryAndEmbeddingWithin(String country, Vector embedding, Score distance);
23 | }
24 | ----
25 | ====
26 |
27 | Vector Search methods are not required to include a score or distance in their projection.
28 | When using annotated search methods returning `SearchResults`, the execution mechanism assumes that if a second projection column is present that this one holds the score value.
29 |
--------------------------------------------------------------------------------
/src/main/antora/modules/ROOT/partials/vector-search-method-derived-include.adoc:
--------------------------------------------------------------------------------
1 | .Using `Near` and `Within` Keywords in Repository Search Methods
2 | ====
3 | [source,java]
4 | ----
5 | interface CommentRepository extends Repository {
6 |
7 | SearchResults searchByEmbeddingNear(Vector vector, Score score);
8 |
9 | SearchResults searchByEmbeddingWithin(Vector vector, Range range);
10 |
11 | SearchResults searchByCountryAndEmbeddingWithin(String country, Vector vector, Range range);
12 | }
13 | ----
14 | ====
15 |
16 | Derived search methods can declare predicates on domain model attributes and Vector parameters.
17 |
--------------------------------------------------------------------------------
/src/main/antora/modules/ROOT/partials/vector-search-model-include.adoc:
--------------------------------------------------------------------------------
1 | ====
2 | [source,java]
3 | ----
4 | class Comment {
5 |
6 | @Id String id;
7 | String country;
8 | String comment;
9 |
10 | @Column(name = "the_embedding")
11 | @JdbcTypeCode(SqlTypes.VECTOR)
12 | @Array(length = 5)
13 | Vector embedding;
14 |
15 | // getters, setters, …
16 | }
17 | ----
18 | ====
19 |
--------------------------------------------------------------------------------
/src/main/antora/modules/ROOT/partials/vector-search-repository-include.adoc:
--------------------------------------------------------------------------------
1 | .Using `SearchResult` in a Repository Search Method
2 | ====
3 | [source,java]
4 | ----
5 | interface CommentRepository extends Repository {
6 |
7 | SearchResults searchByCountryAndEmbeddingNear(String country, Vector vector, Score distance,
8 | Limit limit);
9 |
10 | @Query("""
11 | SELECT c, cosine_distance(c.embedding, :embedding) as distance FROM Comment c
12 | WHERE c.country = ?1
13 | AND cosine_distance(c.embedding, :embedding) <= :distance
14 | ORDER BY distance asc""")
15 | SearchResults searchAnnotatedByCountryAndEmbeddingWithin(String country, Vector embedding,
16 | Score distance);
17 | }
18 |
19 | SearchResults results = repository.searchByCountryAndEmbeddingNear("en", Vector.of(…), Score.of(0.9), Limit.of(10));
20 | ----
21 | ====
22 |
--------------------------------------------------------------------------------
/src/main/antora/resources/antora-resources/antora.yml:
--------------------------------------------------------------------------------
1 | version: ${antora-component.version}
2 | prerelease: ${antora-component.prerelease}
3 |
4 | asciidoc:
5 | attributes:
6 | version: ${project.version}
7 | copyright-year: ${current.year}
8 | springversionshort: ${spring.short}
9 | springversion: ${spring}
10 | attribute-missing: 'warn'
11 | commons: ${springdata.commons.docs}
12 | include-xml-namespaces: false
13 | spring-data-commons-docs-url: https://docs.spring.io/spring-data/commons/reference
14 | spring-data-commons-javadoc-base: https://docs.spring.io/spring-data/commons/docs/${springdata.commons}/api/
15 | springdocsurl: https://docs.spring.io/spring-framework/reference/{springversionshort}
16 | springjavadocurl: https://docs.spring.io/spring-framework/docs/${spring}/javadoc-api
17 | spring-framework-docs: '{springdocsurl}'
18 | spring-framework-javadoc: '{springjavadocurl}'
19 | springhateoasversion: ${spring-hateoas}
20 | hibernatejavadocurl: https://docs.jboss.org/hibernate/orm/6.6/javadocs/
21 | releasetrainversion: ${releasetrain}
22 | store: Jpa
23 |
--------------------------------------------------------------------------------