This question is locked. New answers and comments are not allowed.
We are currently using OpenAccess Free Edition version 3.5 with Firebird Server version 2.1 and Firebird DotNet Client version 2.7.0.0 in Visual Studio 2010.
I followed this tutorial to map Firebird ID generator with Telerik :
http://www.telerik.com/help/openaccess-orm/database-specifics-firebird-auto-inc-columns.html
When I set IdentityMechanism to DatabaseServerCalculated I get the following exception when trying to insert an object into the database:
Telerik.OpenAccess.Exceptions.DataStoreException was caught
Message=Insert of '2141609161-' failed: System.InvalidCastException: Unable to cast object of type 'System.Int32' to type 'FirebirdSql.Data.FirebirdClient.FbParameter'.
at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.execute()
at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.execute()
at OpenAccessRuntime.Relational.RelationalStorageManager.generateInserts(NewObjectOID oid, Int32 index, ClassMetaData cmd, PersistGraph graph, Int32[] fieldNos, CharBuf s, Object[] oidData, IntArray toUpdateIndexes)
INSERT INTO "PRODUCT" ("DESCRIPTION", "NAME", "TYPE", "TYPE_TEXT", "USE_QUANTITY") VALUES (?, ?, ?, ?, ?) returning "ID"
(set event logging to all to see parameter values) System.InvalidCastException: Unable to cast object of type 'System.Int32' to type 'FirebirdSql.Data.FirebirdClient.FbParameter'.
at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.execute()
at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.execute()
at OpenAccessRuntime.Relational.RelationalStorageManager.generateInserts(NewObjectOID oid, Int32 index, ClassMetaData cmd, PersistGraph graph, Int32[] fieldNos, CharBuf s, Object[] oidData, IntArray toUpdateIndexes)
Source=Telerik.OpenAccess
CanRetry=false
StackTrace:
at Telerik.OpenAccess.SPI.Backends.ThrowException(Exception e)
at Telerik.OpenAccess.RT.ExceptionWrapper.Throw()
at OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.handleException(Exception x)
at OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.internalCommit(Boolean phase)
at OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.commit()
at Telerik.OpenAccess.RT.EnlistableObjectScope.CommitChanges()
at Telerik.OpenAccess.OpenAccessContextBase.SaveChanges(ConcurrencyConflictsProcessingMode failureMode)
at Telerik.OpenAccess.OpenAccessContextBase.SaveChanges()
at GestionSoumissionTelerik.Database.InsertProduct(PRODUCT product) in D:\Visual Studio\Projects\GestionSoumissionTelerik\Database.cs:line 74
InnerException: System.InvalidCastException
Message=Unable to cast object of type 'System.Int32' to type 'FirebirdSql.Data.FirebirdClient.FbParameter'.
Source=Telerik.OpenAccess.Runtime
StackTrace:
at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.execute()
at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.execute()
at OpenAccessRuntime.Relational.RelationalStorageManager.generateInserts(NewObjectOID oid, Int32 index, ClassMetaData cmd, PersistGraph graph, Int32[] fieldNos, CharBuf s, Object[] oidData, IntArray toUpdateIndexes)
InnerException:
_______________________
If I set IdentityMechanism to Default, the record is correctly inserted into the database but the object becomes corrupted (unusable) after insertion. I would like to use IdentityMechanism DatabaseServerCalculated to get the generated Id from Firebird and use the object after insertion. Unfortunately this is not possible because when using DatabaseServerCalculated Telerik throws the exception above on insert and fail to insert the record in the database.
I followed this tutorial to map Firebird ID generator with Telerik :
http://www.telerik.com/help/openaccess-orm/database-specifics-firebird-auto-inc-columns.html
When I set IdentityMechanism to DatabaseServerCalculated I get the following exception when trying to insert an object into the database:
Telerik.OpenAccess.Exceptions.DataStoreException was caught
Message=Insert of '2141609161-' failed: System.InvalidCastException: Unable to cast object of type 'System.Int32' to type 'FirebirdSql.Data.FirebirdClient.FbParameter'.
at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.execute()
at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.execute()
at OpenAccessRuntime.Relational.RelationalStorageManager.generateInserts(NewObjectOID oid, Int32 index, ClassMetaData cmd, PersistGraph graph, Int32[] fieldNos, CharBuf s, Object[] oidData, IntArray toUpdateIndexes)
INSERT INTO "PRODUCT" ("DESCRIPTION", "NAME", "TYPE", "TYPE_TEXT", "USE_QUANTITY") VALUES (?, ?, ?, ?, ?) returning "ID"
(set event logging to all to see parameter values) System.InvalidCastException: Unable to cast object of type 'System.Int32' to type 'FirebirdSql.Data.FirebirdClient.FbParameter'.
at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.execute()
at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.execute()
at OpenAccessRuntime.Relational.RelationalStorageManager.generateInserts(NewObjectOID oid, Int32 index, ClassMetaData cmd, PersistGraph graph, Int32[] fieldNos, CharBuf s, Object[] oidData, IntArray toUpdateIndexes)
Source=Telerik.OpenAccess
CanRetry=false
StackTrace:
at Telerik.OpenAccess.SPI.Backends.ThrowException(Exception e)
at Telerik.OpenAccess.RT.ExceptionWrapper.Throw()
at OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.handleException(Exception x)
at OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.internalCommit(Boolean phase)
at OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.commit()
at Telerik.OpenAccess.RT.EnlistableObjectScope.CommitChanges()
at Telerik.OpenAccess.OpenAccessContextBase.SaveChanges(ConcurrencyConflictsProcessingMode failureMode)
at Telerik.OpenAccess.OpenAccessContextBase.SaveChanges()
at GestionSoumissionTelerik.Database.InsertProduct(PRODUCT product) in D:\Visual Studio\Projects\GestionSoumissionTelerik\Database.cs:line 74
InnerException: System.InvalidCastException
Message=Unable to cast object of type 'System.Int32' to type 'FirebirdSql.Data.FirebirdClient.FbParameter'.
Source=Telerik.OpenAccess.Runtime
StackTrace:
at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.execute()
at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.execute()
at OpenAccessRuntime.Relational.RelationalStorageManager.generateInserts(NewObjectOID oid, Int32 index, ClassMetaData cmd, PersistGraph graph, Int32[] fieldNos, CharBuf s, Object[] oidData, IntArray toUpdateIndexes)
InnerException:
_______________________
If I set IdentityMechanism to Default, the record is correctly inserted into the database but the object becomes corrupted (unusable) after insertion. I would like to use IdentityMechanism DatabaseServerCalculated to get the generated Id from Firebird and use the object after insertion. Unfortunately this is not possible because when using DatabaseServerCalculated Telerik throws the exception above on insert and fail to insert the record in the database.