fromDataSource

fun fromDataSource(dataSource: DataSource, ownsDataSource: Boolean = false, dynamicJson: Json = octaviusJson, dynamicWriteStrategy: DynamicWriteStrategy = DynamicWriteStrategy.AUTOMATIC_WHEN_UNAMBIGUOUS): OctaviusClient

Builds a client over dataSource, running its own transactions on the calling thread.

This is the standalone case: a connection pool, and nothing else deciding when transactions begin and end. Where a framework owns transactions itself, give it a SessionProvider that finds the session where that framework put it, through fromSessionProvider, or the two will each open one.

Return

A client ready to use.

Parameters

dataSource

Where connections come from.

ownsDataSource

Whether close should close dataSource as well. Leave it false for a pool the application built and shuts down itself.

dynamicJson

How dynamic_dto payloads are read and written. Only consulted where dynamic types are registered at all. The default is octaviusJson: strict, and carrying the contextual serializers a BigDecimal or an unbounded date needs to survive JSON.

dynamicWriteStrategy

When an unwrapped instance of a registered class is written as a dynamic_dto.