StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



Insert Fails on BOs Created From ViewsExpand / Collapse
Author
Message
Posted 04/09/2008 3:28:15 PM


StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: 08/26/2008 10:34:32 AM
Posts: 78, Visits: 242
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

Post #15476
Posted 04/09/2008 5:51:01 PM
Advanced StrataFrame User

Advanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame User

Group: StrataFrame Users
Last Login: Today @ 6:32:39 PM
Posts: 534, Visits: 2,203
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
Progytech (Computer Consultants)
Post #15480
Posted 04/09/2008 10:22:05 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Today @ 4:17:19 AM
Posts: 4,379, Visits: 4,420
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.
Post #15489
Posted 04/10/2008 12:15:11 PM


StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: 08/26/2008 10:34:32 AM
Posts: 78, Visits: 242
Thanks much folks...that did the trick.
Post #15504
Posted 04/10/2008 5:18:17 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Today @ 4:17:19 AM
Posts: 4,379, Visits: 4,420
Glad to hear it
Post #15513
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Ben Chase, Trent L. Taylor, Steve L. Taylor

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 6:34pm

Powered by InstantForum.NET v4.1.4 © 2008
Execution: 0.078. 10 queries. Compression Enabled.
Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.