Regarding SaveEntity

Posts   
 
    
prabhu
User
Posts: 77
Joined: 20-Dec-2006
# Posted on: 21-Dec-2007 14:53:24   

Hi ,

We are trying to execute a query like this

UPDATE [OptimaTigerDB].[Security].[UserPreference] SET [userPreference]='True'

WHERE ( [OptimaTigerDB].[Security].[UserPreference].[userId] = 164 AND

[OptimaTigerDB].[Security].[UserPreference].[preferenceId] = 1))

We are using the LLBLGen 2.5 and adapter method.

Calling SaveEntity(EntityName, refetchAfterSave, updateRestriction, recurse) method.

We are passing refetchAfterSave=false, recurse = true and setting the predicate with userid and preference fields. We want to update all the rows with the matching conditions.No primary key used to update.While we try to run getting the following query

UPDATE [OptimaTigerDB].[Security].[UserPreference] SET [userPreference]='True'

WHERE ( ( [OptimaTigerDB].[Security].[UserPreference].[id] IS NULL) AND

( [OptimaTigerDB].[Security].[UserPreference].[userId] = 164 AND

[OptimaTigerDB].[Security].[UserPreference].[preferenceId] = 1))

Please let us know why runtime is checking the primary key field to is null and also we are getting the following error

"During a save action an entity's update action failed. The entity which failed is enclosed"

Help is very much appreciated.

Regards

Prabhu

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 21-Dec-2007 15:06:17   

We want to update all the rows with the matching conditions.No primary key used to update.While we try to run getting the following query

You should be using the DataAccessAdapter UpdateEntitiesDirectly() method.

prabhu
User
Posts: 77
Joined: 20-Dec-2006
# Posted on: 21-Dec-2007 15:31:56   

Hi Waala,

Thanks..It's working fine.

Regards

Prabhu