Oracle, BusinessObjects & PrimaryKeyIsAutoIncremented on Update


Author
Message
Kari Paukku
Kari Paukku
StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)
Group: Forum Members
Posts: 65, Visits: 820
Hi,

noticed that when updating existing data the update fails
if the PrimaryKeyIsAutoIncremented is set to TRUE (=default (?)).

It's open to discussion if the default should be true or false, but in my opinion this shouldn't have effect when doing an update to data that already exists in the database....

Kari

Replies
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
What is the error that you're getting?  During an UPDATE operation, the primary key is always passed, no matter whether the PrimaryKeyIsAutoIncremented property is set to true or false.  Could you also tell me what CRUD settings you have (sprocs/no sprocs, concurrency type, etc.).
Kari Paukku
Kari Paukku
StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)
Group: Forum Members
Posts: 65, Visits: 820
Ben,

below is the error message. A comment to the error message that's in red: the primary key is type of VARCHAR2, not a NUMBER. This may be the reason for the error....

Kari

BusinessLayerException
 An error occurred while saving an the data to the server.
DataLayerSavingException
 Cannot create UPDATE command because PrimaryKeyIsAutoIncremented = True and the PrimaryKeyField is not a valid
auto-increment data type.
Exception
 Cannot create UPDATE command because PrimaryKeyIsAutoIncremented = True and the PrimaryKeyField is not a valid auto-increment data type.

Source     : MicroFour StrataFrame Business

Stack Trace:
   at MicroFour.StrataFrame.Data.DataLayer.BuildUpdateInfo(DataTable UpdatingTable, Boolean Transactional, String TransactionKey)
   at MicroFour.StrataFrame.Data.DataLayer.UpdateDataTableThread(Object ThreadParams)
   at MicroFour.StrataFrame.Data.DataLayer.SaveByForm(DataTable TableToSave, Boolean Transactional, String TransactionKey)
   at MicroFour.StrataFrame.Business.BusinessLayer.SaveByForm(Boolean Transactional, String TransactionKey)
   at MicroFour.StrataFrame.UI.Windows.Forms.BaseForm.Save(Boolean Transactional, String TransactionKey)
   at MicroFour.StrataFrame.UI.Windows.Forms.BaseForm.OnFormClosing(FormClosingEventArgs e)
   at System.Windows.Forms.Form.WmClose(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Ah yes, if the primary key is not a numeric data type, then it cannot be auto-incremented by the server.  You will need to manually assign a primary key to the record since the data type cannot be auto-incremented.
Kari Paukku
Kari Paukku
StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)
Group: Forum Members
Posts: 65, Visits: 820
Hi,

yes, but when updating an existing record there is no need to increment anything....

"Cannot create UPDATE command because PrimaryKeyIsAutoIncremented = True and the PrimaryKeyField is not a valid auto-increment data type."

Kari

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
You should not get this message when an UPDATE is called.  The only time this matters is when INSERTing a new record.  If you do not want the BO to auto-retrieve the PK on INSERTs then simply set the PrimaryKeyIsAutoIncrementing property to False on the BO.
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