diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/builder/HibernatePagingItemReaderBuilder.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/builder/HibernatePagingItemReaderBuilder.java index 9dffb9975b..2d614a0cd3 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/builder/HibernatePagingItemReaderBuilder.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/builder/HibernatePagingItemReaderBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 the original author or authors. + * Copyright 2017-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,6 +35,7 @@ * * @author Michael Minella * @author Glenn Renfro + * @author Mahmoud Ben Hassine * @since 4.0 * @see HibernatePagingItemReader */ @@ -223,8 +224,24 @@ public HibernatePagingItemReaderBuilder sessionFactory(SessionFactory session * @param useStatelessSession Defaults to false * @return this instance for method chaining * @see HibernatePagingItemReader#setUseStatelessSession(boolean) + * @deprecated This method is deprecated in favor of + * {@link HibernatePagingItemReaderBuilder#useStatelessSession} and will be + * removed in version 4.2. */ + @Deprecated public HibernatePagingItemReaderBuilder useSatelessSession(boolean useStatelessSession) { + return useStatelessSession(useStatelessSession); + } + + /** + * Indicator for whether to use a {@link org.hibernate.StatelessSession} + * (true) or a {@link org.hibernate.Session} (false). + * + * @param useStatelessSession Defaults to false + * @return this instance for method chaining + * @see HibernatePagingItemReader#setUseStatelessSession(boolean) + */ + public HibernatePagingItemReaderBuilder useStatelessSession(boolean useStatelessSession) { this.statelessSession = useStatelessSession; return this; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/builder/HibernatePagingItemReaderBuilderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/builder/HibernatePagingItemReaderBuilderTests.java index bc230c3f42..bb27631d0e 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/builder/HibernatePagingItemReaderBuilderTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/builder/HibernatePagingItemReaderBuilderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 the original author or authors. + * Copyright 2017-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,6 +47,7 @@ /** * @author Michael Minella + * @author Mahmoud Ben Hassine */ public class HibernatePagingItemReaderBuilderTests { @@ -78,7 +79,7 @@ public void testConfiguration() throws Exception { .maxItemCount(4) .pageSize(5) .queryName("allFoos") - .useSatelessSession(false) + .useStatelessSession(false) .build(); reader.afterPropertiesSet();