Hello,
We are using an Oracle database and are using Silverlight + RIA/DDS. We have an Accounts table that contains account information for our customers. The information in this table is common to all of our customers regardless of the Silverlight application that they are subscribed to use. Its primary key is a column named "AccountId". This column has an Oracle sequence attached to it so the values are automatically incremented on each insert.
For one of our subscription applications, there is a a subclass of Accounts named "EtraxAccounts". It contains information that is specific to that application such as whether it is available to the customer. This table has an AccountId field, which was inherited from the Accounts entity.
So, here is the question... Why won't the sequence assigned to the AccountId column in the Accounts table not automatically increment when inserting a new EtraxAccount record? If I insert a new record in Accounts using SQL in a command window, it properly increments. However, the inserted record using our DAL had an AccountId of 0 rather than 3 in the database tables.
Here is what I did...
I created a new EtraxAccount entity, placed values in the required fields, and inserted it into the EtraxAccount table through our domain data source method (shown below). It was successful, but the AccountId was zero rather than the next value in the AccountId sequence in the Accounts table (parent to the EtraxAccount table, see attached pictures).
I would appreciate your help sorting out this issue... We definitely believe that using subclasses is a great way to partition our application specific data, so this question is very important to us.
Thank you for your help and time!
Mike
-------------------- DomainDataSource Insert Method ------------
[Insert]
public void InsertEtraxAccount(EtraxAccountEntity theEtraxAccount)
{
var adapter = new DataAccessAdapter();
theEtraxAccount.IsNew = true; // Indicate that it is new
adapter.SaveEntity(theEtraxAccount);
//adapter.Commit();
}
---------------- BASIC DATABASE STRUCTURE --------------
Account (abstract)
AccountId (primary key, autoincremented via Oracle sequence on inserts)
AccountLabel (unique name presented to users when they want to select an account)
Address
City
.
.
.
EtraxAccount (subclass of Account)
AccountId (inherited from Account, primary key)
AnotherField (a field that is specific to an EtraxAccount.
.
.
.