This is a migrated thread and some comments may be shown as answers.
Error On Commit?
3 Answers 40 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Sean
Top achievements
Rank 2
Sean asked on 07 Jun 2009, 07:25 PM
I came back to an old personal project and updated the ORM to the latest release. Now when I commit() the objct it throws an error.
here is the code:

           readonly IObjectScope sc = AQDataContext.GetNewObjectScope();
           sc.Transaction.Begin();

            var tGame = new Tblgame();
            var descrip = HttpUtility.HtmlEncode(txtDescription.Text);
            var added = HttpUtility.HtmlEncode(txtAdditional.Text);
            tGame.DateSubmitted = DateTime.Now;
            tGame.Description = descrip;
            tGame.Additional = added;
            tGame.GameName = txtGameName.Text;
            tGame.IsLurkable = chkLurker.Checked ? true : false;
            tGame.NumberOfPlayers = int.Parse(txtPlayerCount.Text);
            tGame.RefereeId = CurrentUser.UserId;
            tGame.RulesId = int.Parse(ddlRules.SelectedValue);
            tGame.Status = "Awaiting Approval";
            tGame.IsPublic = chkPublic.Checked ? true : false;

            try
            {
                sc.Add(tGame);
                sc.Transaction.Commit(); //ERROR IS HERE
            }
            catch (Exception ex)
            {
                throw new Exception("Error in game submission", ex);
            }

Here is the error stack trace:

[SQLException: Not implemented yet: setAsciiStream]   Telerik.OpenAccess.RT.Adonet2Generic.Impl.StatementImp.SQLException(String s) +55   Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.NotImplementedYet(String t) +48   Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.setAsciiStream(Int32 parameterIndex, Stream x, Int32 length) +37   OpenAccessRuntime.Relational.conn.PooledPreparedStatement.setAsciiStream(Int32 parameterIndex, Stream x, Int32 length) +52   OpenAccessRuntime.Relational.sql.conv.AsciiStreamConverter.setValue(PreparedStatement ps, Int32 index, RelationalColumn col, Object value_Renamed) +201   OpenAccessRuntime.Relational.RelationalGenericState.setParams(PreparedStatement ps, Int32[] stateFieldNos, Int32 firstFieldNo, Int32 lastFieldNo, Int32 firstParam, PersistGraph pGraph, Int32 tableNo) +445   OpenAccessRuntime.Relational.RelationalStorageManager.generateInserts(NewObjectOID oid, Int32 index, ClassMetaData cmd, PersistGraph graph, Int32[] fieldNos, CharBuf s, Object[] oidData, IntArray toUpdateIndexes) +2099[DataStoreException: Error setting parameters on PreparedStatement for insert of '1541616495-0':Telerik.OpenAccess.RT.sql.SQLException: Not implemented yet: setAsciiStream   at Telerik.OpenAccess.RT.Adonet2Generic.Impl.StatementImp.SQLException(String s)   at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.NotImplementedYet(String t)   at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.setAsciiStream(Int32 parameterIndex, Stream x, Int32 length)   at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.setAsciiStream(Int32 parameterIndex, Stream x, Int32 length)   at OpenAccessRuntime.Relational.sql.conv.AsciiStreamConverter.setValue(PreparedStatement ps, Int32 index, RelationalColumn col, Object value_Renamed)   at OpenAccessRuntime.Relational.RelationalGenericState.setParams(PreparedStatement ps, Int32[] stateFieldNos, Int32 firstFieldNo, Int32 lastFieldNo, Int32 firstParam, PersistGraph pGraph, Int32 tableNo)   at OpenAccessRuntime.Relational.RelationalStorageManager.generateInserts(NewObjectOID oid, Int32 index, ClassMetaData cmd, PersistGraph graph, Int32[] fieldNos, CharBuf s, Object[] oidData, IntArray toUpdateIndexes)INSERT INTO `tblgames` (`Additional`, `AllowsMultiplePC`, `DateClosed`, `DateSubmitted`, `Description`, `GameId`, `GameName`, `IsLurkable`, `IsPublic`, `NumberOfPlayers`, `RefereeId`, `RulesId`, `Status`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)(set event logging to all to see parameter values) Telerik.OpenAccess.RT.sql.SQLException: Not implemented yet: setAsciiStream   at Telerik.OpenAccess.RT.Adonet2Generic.Impl.StatementImp.SQLException(String s)   at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.NotImplementedYet(String t)   at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.setAsciiStream(Int32 parameterIndex, Stream x, Int32 length)   at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.setAsciiStream(Int32 parameterIndex, Stream x, Int32 length)   at OpenAccessRuntime.Relational.sql.conv.AsciiStreamConverter.setValue(PreparedStatement ps, Int32 index, RelationalColumn col, Object value_Renamed)   at OpenAccessRuntime.Relational.RelationalGenericState.setParams(PreparedStatement ps, Int32[] stateFieldNos, Int32 firstFieldNo, Int32 lastFieldNo, Int32 firstParam, PersistGraph pGraph, Int32 tableNo)   at OpenAccessRuntime.Relational.RelationalStorageManager.generateInserts(NewObjectOID oid, Int32 index, ClassMetaData cmd, PersistGraph graph, Int32[] fieldNos, CharBuf s, Object[] oidData, IntArray toUpdateIndexes)]   Telerik.OpenAccess.SPI.Backends.ThrowException(Exception e) +28   Telerik.OpenAccess.RT.ExceptionWrapper.Throw() +34   OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.handleException(Exception x) +1455   OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.internalCommit(Boolean phase) +582   OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.commit() +188   OpenAccessRuntime.DataObjects.UnsynchronizedPMProxy.commit() +42   Telerik.OpenAccess.RT.TransactionImpl.Commit() +115   AgoraQuest.Members.NewGame.btnSubmit_Click(Object sender, EventArgs e) in C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AgoraQuest\AgoraQuest\Members\NewGame.aspx.cs:55[Exception: Error in game submission]   AgoraQuest.Members.NewGame.btnSubmit_Click(Object sender, EventArgs e) in C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AgoraQuest\AgoraQuest\Members\NewGame.aspx.cs:60   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565

Thanks for any help. I can't submit a ticket or I would ask there. :)

Sean 

3 Answers, 1 is accepted

Sort by
0
Jan Blessenohl
Telerik team
answered on 08 Jun 2009, 07:39 AM
Hi Sean ,
This has been fixed in the latest custom build. You can find the custom build in your download area.

Regards,
Jan Blessenohl
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Sean
Top achievements
Rank 2
answered on 09 Jun 2009, 05:18 AM
Thanks for the fix, Jan.

Now I have a second issue. :)

The transaction commits the record to the database, but when i try to retrieve the record ID (I need this for a mapping table insert) the value returned is 0.

As such:
   try 
            { 
                sc.Add(tGame); 
                sc.Transaction.Commit(); 
                 
                sc.Transaction.Begin(); 
                var id = sc.GetObjectId(tGame); //This is always '0'
                tUserGame.GameId = int.Parse(id.ToString()); 
                tUserGame.UserId = tUser.UserId; 
                tUserGame.RoleId = tRole.RoleId; 
                sc.Add(tUserGame); 
                sc.Transaction.Commit(); 
 
            } 
            catch (Exception ex) 
            { 
                throw new Exception("Error in game submission", ex); 
            } 

         
0
Jan Blessenohl
Telerik team
answered on 09 Jun 2009, 07:37 AM
Hi Sean ,
var id is an IObjectId instance. Can you tell me what id.ToString() and Database.Oid.ToString(id) really returns?

Kind regards,
Jan Blessenohl
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Development (API, general questions)
Asked by
Sean
Top achievements
Rank 2
Answers by
Jan Blessenohl
Telerik team
Sean
Top achievements
Rank 2
Share this question
or