Record Class BatchSize
java.lang.Object
java.lang.Record
org.hibernate.BatchSize
- Record Components:
batchSize- The batch size
- All Implemented Interfaces:
FindOption, FindMultipleOption
@Deprecated(since="8.0",
forRemoval=true)
public record BatchSize(int batchSize)
extends Record
implements FindMultipleOption
Deprecated, for removal: This API element is subject to removal in a future version.
Specifies a batch size, that is, how many entities should be
fetched in each request to the database, for an invocation of
Session.findMultiple(Class, List, FindOption...).
- By default, the batch sizing strategy is determined by the SQL dialect, but
- if some
batchSize>1is specified as an argument to this method, then that batch size will be 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.
Session.find(Class, Object, FindOption...).- Since:
- 7.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface FindMultipleOption
FindMultipleOption.BatchSize, FindMultipleOption.OrderingMode, FindMultipleOption.RemovalsMode, FindMultipleOption.SessionCheckMode -
Constructor Summary
ConstructorsConstructorDescriptionBatchSize(int batchSize) Deprecated, for removal: This API element is subject to removal in a future version.Creates an instance of aBatchSizerecord class. -
Method Summary
Modifier and TypeMethodDescriptionintDeprecated, for removal: This API element is subject to removal in a future version.Returns the value of thebatchSizerecord component.final booleanDeprecated, for removal: This API element is subject to removal in a future version.Indicates whether some other object is "equal to" this one.final inthashCode()Deprecated, for removal: This API element is subject to removal in a future version.Returns a hash code value for this object.final StringtoString()Deprecated, for removal: This API element is subject to removal in a future version.Returns a string representation of this record class.
-
Constructor Details
-
BatchSize
public BatchSize(int batchSize) Deprecated, for removal: This API element is subject to removal in a future version.Creates an instance of aBatchSizerecord class.- Parameters:
batchSize- the value for thebatchSizerecord component
-
-
Method Details
-
toString
Deprecated, for removal: This API element is subject to removal in a future version.Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Deprecated, for removal: This API element is subject to removal in a future version.Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Deprecated, for removal: This API element is subject to removal in a future version.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
-
FindMultipleOption.BatchSize.