Saving entity doesn't work

Posts   
 
    
peerke
User
Posts: 23
Joined: 19-Aug-2008
# Posted on: 28-Aug-2008 13:32:50   

Hi all,

I'm having problems when trying to save multiple entities in an EntityCollection. I must be doing something wrong, but I can't figure what it is. This is my code:



            BatchstatusCollection batchStatusCollection = new BatchstatusCollection();
            IPredicateExpression filter = new PredicateExpression();
            filter.Add(BatchstatusFields.Status == Constants.BatchStatusRunning);
            filter.Add(BatchstatusFields.Programname == Constants.ProgramName);
            filter.Add(BatchstatusFields.Enddate == DBNull.Value);

            batchStatusCollection.GetMulti(filter);

            foreach (BatchstatusEntity entity in batchStatusCollection)
            {
                entity.Enddate = DateTime.Now;
                entity.Status = Constants.BatchStatusFinished;
            }
            batchStatusCollection.SaveMulti();


The EntityCollection is filled correctly as expected. Also, the changed entities' IsDirty propery is true after the foreach loop. There is no exception whatsoever, but the changes arent't saved to the database either. The output window doesn't show anything when I step over the SaveMulti statement (I was expecting an UPDATE-statement). Using the entities Save method instead of the SaveMulti makes no difference. What am I doing wrong?

latest LLBLGen Pro 2.6 SelfServicing templates Oracle 10g + MS driver .NET 3.5 SP1

Help is appreciated.

Regards, peerke

peerke
User
Posts: 23
Joined: 19-Aug-2008
# Posted on: 28-Aug-2008 14:21:41   

Figured it out, the table in question didn't have a Primary Key defined :-( After correcting this and re-generating the code, everything worked fine.

peerke