Open
Description
We have a database(Oracle) sequence that increments 100 at a time, sequence mapped with below method so 1000 Entity Save method access calls 10 times to database for new Sequence.nextval.
Wit a stateless session (and adonet.batch_size = 1000, order_updates = true in hibernate.cfg.xml), every 100 + 1 calls, Save
triggers the batcher. It's uses same Batcher instance with SequenceStyleGenerator. Why "SequenceStyleGenerator" needs batcher at all, just to reads one line of data?
(With a statefull session (and adonet.batch_size = 1000, order_updates = true in hibernate.cfg.xml), every 100 Save calls just triggers Sequence.nextval. Batcher waits until batch size(1000) to get triggered.)
Fluent Mapping:
Id(x => x.Guid).Column("GUID").GeneratedBy.PooledSequence(100);
public static TParent PooledSequence<TParent>(this IdentityGenerationStrategyBuilder<TParent> generationStrategyBuilder, int allocationSize = 1, string sequenceName = "")
{
return generationStrategyBuilder.Custom<SequenceStyleGenerator>(p =>
{
p.AddParam("sequence_name", string.IsNullOrEmpty(sequenceName) ? DefaultPooledSequenceName : sequenceName);
p.AddParam("value_column", "NEXT_VALUE");
p.AddParam("optimizer", "pooled");
p.AddParam("increment_size", allocationSize.ToString());
});
}