ydb-platform / yoj-project

YDB ORM for Java (YOJ) is a lightweight ORM for immutable entities. It has native support for YDB and is battle-tested.
Apache License 2.0
13 stars 12 forks source link

#80: Minimal compatibility: Return YDB SDK's YdbTransaction from YOJ's YdbRepositoryTransaction #87

Closed nvamelichev closed 1 month ago

nvamelichev commented 1 month ago

Experimental API: Add minimal compatibility between new YDB SDK's YdbTransaction and YOJ's YdbRepositoryTransaction, accessible inside transaction body via

Tx tx = Tx.Current.get();
// YOJ tx:
YdbRepositoryTransaction yojTx = (YdbRepositoryTransaction) tx.getRepositoryTransaction();
// YDB SDK tx:
YdbTransaction ydbTx = yojTx.toSdkTransaction();

In the compatibility wrapper, the getStatusFuture() method always throws UnsupportedOperationException, and other methods are fully functional (getSessionId() will throw if there is no active YDB session, though.)