Insert Fails on BOs Created From Views


Author
Message
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Glad to hear it Smile
choyt
choyt
StrataFrame Novice (98 reputation)StrataFrame Novice (98 reputation)StrataFrame Novice (98 reputation)StrataFrame Novice (98 reputation)StrataFrame Novice (98 reputation)StrataFrame Novice (98 reputation)StrataFrame Novice (98 reputation)StrataFrame Novice (98 reputation)StrataFrame Novice (98 reputation)
Group: Forum Members
Posts: 78, Visits: 246
Thanks much folks...that did the trick.
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Edhy is right on the money...you will need to specify a primary key through the BO mapper...you will also need to make the view updatable by binding to the schema.  So ensure that your view is updatable and then open the BO Mapper and specify a primary key override for the view.
Edhy Rijo
E
StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Clay,

Check the help topic "Business Object Mapper -> Configuring Business Object" where it will show you an option in the BOM to Overrride the Primary Key.  I believe that is what you are missing for.

Here is the quote from the help file:

Override Primary KeyWhen checked, this specification will override the primary key retrieved through the schema mapping. This is useful when a primary key is not be specified on the table itself, when using views (where primary keys cannot be specified on the table at all), when wishing to define compound primary keys, or in cases where you wish to use business object logic without affecting the database.

To define a new primary key specification:
  1. Click the browse button (...) to the right of the text field. A dialog will be displayed containing a list of available fields.
  2. Place a check next to the fields to be used as the primary key. A compound key may be created by checking more than one field.
  3. Click the OK button to accept the new primary key specification.


Edhy Rijo

choyt
choyt
StrataFrame Novice (98 reputation)StrataFrame Novice (98 reputation)StrataFrame Novice (98 reputation)StrataFrame Novice (98 reputation)StrataFrame Novice (98 reputation)StrataFrame Novice (98 reputation)StrataFrame Novice (98 reputation)StrataFrame Novice (98 reputation)StrataFrame Novice (98 reputation)
Group: Forum Members
Posts: 78, Visits: 246
When we attempt to do an NewRow/Save through a BO that was created based on a VIEW, we get this error

"Cannot create INSERT command because the business object does not contain any PrimaryKeyFields"

I tried to set the PrimaryKey in the BO but that is a read only property.

Is there a way to work around this?

Thanks!

Clay

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