Record Class SessionCreationOption.FetchBatchSize
java.lang.Object
java.lang.Record
org.hibernate.SessionCreationOption.FetchBatchSize
- Record Components:
batchSize- The batch size
- All Implemented Interfaces:
EntityManager.CreationOption
- Enclosing interface:
SessionCreationOption
public static record SessionCreationOption.FetchBatchSize(int batchSize)
extends Record
implements EntityManager.CreationOption
Enables batch fetching and specifies how many entities should be fetched in each request to the database.
- By default, the batch sizing strategy is determined by the SQL Dialect, but
- if some
batchSize>1is specified using this option, then that batch size is used.
If an explicit batch size is set manually, care should be taken to not exceed the capabilities of the underlying database.
The performance impact of setting a batch size depends on whether a SQL array may be used to pass the list of identifiers to the database:
- for databases which support standard SQL arrays, a smaller batch size might be extremely inefficient compared to a very large batch size or no batching at all, but
- on the other hand, for databases with no SQL array type, a large batch size results in long SQL statements with many JDBC parameters.
- Since:
- 8.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionFetchBatchSize(int batchSize) Creates an instance of aFetchBatchSizerecord class. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of thebatchSizerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
FetchBatchSize
public FetchBatchSize(int batchSize) Creates an instance of aFetchBatchSizerecord class.- Parameters:
batchSize- the value for thebatchSizerecord component
-
-
Method Details
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with thecomparemethod from their corresponding wrapper classes. -
batchSize
-