Connecting to Databricks via Simba Odbc Driver

I’m utilizing nHibernate/Unit of Work/Repository pattern to connect to a sql server database. The solution is built in a .net 6 c# blazor app. Everything works great.

There is a company directive to move to databricks so I’ve been trying to integrate nHibernate with the Simba ODBC driver. I’m able to pull data from my databricks tables. The issue arises when I try to insert/update records. When I call my unitOfWork.Commit() method, the data is added/updated in databricks. The problem arises when I continue to step through the code. I’m receiving the following errors right after the commit call.

Inserting Error: Nhibernate.StaleStateException ‘Unexpected row count -1; expected 1’.

            try
            {
                unitOfWork.BeginTransaction(dbConnectionString);
                int newAgencyId = await GetLastDimAgencyIdAsync();
                dimAgency.Id = newAgencyId + 1;
                var result = await dbContext.DimAgencyRepo.AddAsync(dimAgency);
                //await dbContext.DimAgencyRepo.FlushAsync();
                await unitOfWork.Commit();
                return (int)result;
            }

Updating Error: Nhibernate.StaleObjectStateException: 'Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect)

            try
            {
                unitOfWork.BeginTransaction(dbConnectionString);
                dbContext.DimAgencyRepo.Update(dimAgency);
                unitOfWork.CommitTransaction();
                return true;
            }

Note there is only one transaction happening, there are no other transactions involved. I’ve also tried to implement ‘versioning’ in my table/model/mapping class to no avail.

Any ideas on where to begin to trouble shoot would be greatly appreciated?

This is the forum for Hibernate ORM, the Java framework. nHibernate is a different project that has nothing to do with this community. Please reach out to the community of that project through their channels instead.