Hi Henrik,
Thanks for the suggestion, that makes sense.
I made the change to my code:
Still get an exception, but it is different now:
Insert of '1829379833-' failed: Telerik.OpenAccess.RT.sql.SQLException: Cannot insert the value NULL into column 'MasterId', table 'OATest.dbo.Detail'; column does not allow nulls. INSERT fails.
The statement has been terminated.
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 [Detail] ([MasterId], [Street]) VALUES (?, ?)
select scope_identity()
(set event logging to all to see parameter values) Telerik.OpenAccess.RT.sql.SQLException: Cannot insert the value NULL into column 'MasterId', table 'OATest.dbo.Detail'; column does not allow nulls. INSERT fails.
The statement has been terminated.
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)
I would expect that OA knows about this Id because of the association (FK constraint) between Master and Detail.
I checked the key generation for both tables and the Identity Mechanism properties are set to "DatabaseServerCalculated". I think this is the correct setting (as per other forum posts) since Default, or HighLow require the voa_keygen table inside the database for internal tracking of Id's.