Insert with Complex PK including identity field


Author
Message
Lukasz Kustusz
Lukasz Kustusz
StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)
Group: Forum Members
Posts: 29, Visits: 125
Hello,

I'm running into problems trying to insert a record into a BO which has multi-field PK, where one of the fields is identity.

Initially I was getting the error as in post http://forum.strataframe.net/Topic26039.aspx. Problem is that when I set 
PrimaryKeyIsUpdable=False
PrimaryKeyIsAutoIncremented=True
I get the following error:
"Cannot create INSERT command because a business object with PrimaryKeyIsAutoIncremented = True must have exactly 1 primary key field."
What else should I try?
Lukasz Kustusz
Lukasz Kustusz
StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)
Group: Forum Members
Posts: 29, Visits: 125
OK, never mind. I recreated the key to include only the identity field (the other two fields were redundant) and it all worked fine.
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.5K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Glad you got is working. There are times when I have both an identity field (which I make the PK as you ended up doing) and also another multi-field unique key, which is more business rule related. If this is the case, then I just make a unique index on the other key, which enforces the business rule at the DB level.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search