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


12»»

Oracle, BusinessObjects &...Expand / Collapse
Author
Message
Posted 09/03/2006 7:28:57 AM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: Forum Members
Last Login: 01/10/2008 9:33:30 AM
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

Post #2630
Posted 09/05/2006 1:31:31 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: 12/02/2008 4:42:46 PM
Posts: 2,686, Visits: 1,890
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.).


www.bungie.net
Post #2638
Posted 09/06/2006 12:24:32 AM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: Forum Members
Last Login: 01/10/2008 9:33:30 AM
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)

Post #2651
Posted 09/06/2006 8:50:47 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: 12/02/2008 4:42:46 PM
Posts: 2,686, Visits: 1,890
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.


www.bungie.net
Post #2656
Posted 09/12/2006 3:56:32 PM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: Forum Members
Last Login: 01/10/2008 9:33:30 AM
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

Post #2774
Posted 09/12/2006 4:15:18 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 7:08:30 PM
Posts: 4,811, Visits: 4,781
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.
Post #2778
Posted 11/25/2008 10:47:48 AM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: 12/02/2008 12:55:10 PM
Posts: 59, Visits: 149
I am having a similar issue with Oracle. The actual Primary Key in the Oracle table has a type of "Numeric". The SF BO Mapper converted this to indicate a type of "Decimal". Unless is set the property on the BO for "PrimaryKeyIsAutoIncremented" to False, an error occurs when I go to SAVE a NEW record:

InvalidOperationException
  Collection was modified; enumeration operation may not execute.

Source     : mscorlib

Stack Trace:
   at System.Collections.ArrayList.ArrayListEnumeratorSimple.MoveNext()
   at System.Windows.Forms.Application.ExitInternal()
   at System.Windows.Forms.Application.Exit(CancelEventArgs e)
   at System.Windows.Forms.Application.Exit()
   at MicroFour.StrataFrame.Application.StrataFrameApplication.ShowThreadExceptionForm(Exception Ex)
   at MicroFour.StrataFrame.Application.StrataFrameApplication.HandleThreadException(Object sender, ThreadExceptionEventArgs e)
   at System.Windows.Forms.Application.ThreadContext.OnThreadException(Exception t)
   at System.Windows.Forms.Control.WndProcException(Exception e)
   at System.Windows.Forms.Control.ControlNativewindow.OnThreadException(Exception e)
   at System.Windows.Forms.Nativewindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.Run(Form mainForm)
   at MicroFour.StrataFrame.Application.StrataFrameApplication.RunApplication()

The Update works, it is just when adding a new record in Oracle. This is not an issue with SQL. The problem with setting the BO property "PrimaryKeyIsAutoIncremented" to False is that although the SAVE works, I show the Primary Key column on the form which now does not get the key that was assigned. It shows blank until I requery the database. Are you aware of this Oracle issue, and is there a fix or workaround other than setting the "PrimaryKeyIsAutoIncremented" to False?

Post #20896
Posted 12/01/2008 12:12:25 PM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: 12/02/2008 12:55:10 PM
Posts: 59, Visits: 149
Could someone PLEASE answer my prior post. I cannot set the property yo false because I need to know the primary key that was assigned. This seems like a bug in SF. If so, is there a work around? If so, what code would I need to insert to insert to compensate.
Post #20944
Posted 12/01/2008 1:17:36 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: 12/02/2008 4:42:46 PM
Posts: 2,686, Visits: 1,890
Looking at the stack trace, the error that you posted is not coming from the Oracle issues, it's coming from the application trying to close down when an the Oracle exception was thrown. 

Stack Trace:
   at System.Collections.ArrayList.ArrayListEnumeratorSimple.MoveNext()
   at System.Windows.Forms.Application.ExitInternal()
   at System.Windows.Forms.Application.Exit(CancelEventArgs e)
   at System.Windows.Forms.Application.Exit()
   at MicroFour.StrataFrame.Application.StrataFrameApplication.ShowThreadExceptionForm(Exception Ex)
   at MicroFour.StrataFrame.Application.StrataFrameApplication.HandleThreadException(Object sender, ThreadExceptionEventArgs e)

Notice how the exception comes from within the System.Windows.Forms.ExitInternal() method?  The HandleThreadException() method raises the UnhandledException static event on the StrataFrameApplication class.  This event should be handled automatically within the program.cs or AppMain.vb file.  So, there should be a red exception dialog popup and show the exception that fired right before this one.  If not, then something has changed within the handler of the UnhandledException event and is setting the e.Handled property to true on the event args. 

In order to diagnose the Oracle problem you're having, I'll need the Oracle exception that is being thrown, not this one that is being thrown when the application is trying to shutdown.  Thanks.


www.bungie.net
Post #20946