Oracle Sequence

Data Access Application Blocks Forum

Oracle Sequence

Postby nead on Thu May 25, 2006 2:42 pm

Start this thread from http://www.mygenerationsoftware.com/phpbb3/viewtopic.php?t=1900 with a more relevant Topic Name.

How is Sequence being generated from EasyObjects Oracle Stored Procedure template?

None of my sql files generated are using sequence at all?

:?: Thanx :!:
nead
Private First Class
 
Posts: 13
Joined: Wed May 24, 2006 3:14 am

Postby mgnoonan on Thu May 25, 2006 3:26 pm

They work the same as dOOdads, as outlined by Mike in this thread:
http://www.mygenerationsoftware.com/phpbb3/viewtopic.php?t=127&highlight=oracle+sequence
Matt Noonan
EasyObjects.NET - The O/RM for the Enterprise Library
http://www.easyobjects.net
User avatar
mgnoonan
Expert
 
Posts: 1019
Joined: Tue Sep 14, 2004 3:17 am
Location: Springboro, OH

Postby mike.griffin on Thu May 25, 2006 4:03 pm

Here's the definitive post on that Matt from our \"Tips and Tricks\" section
http://www.mygenerationsoftware.com/php ... php?t=1293
User avatar
mike.griffin
Site Admin
 
Posts: 3290
Joined: Sat Apr 03, 2004 6:10 am
Location: Indianapolis, IN

Postby nead on Thu May 25, 2006 5:51 pm

Thanx Matt and Mike.

QUestion 1: Oracle Exception: Duplicate parameter
I managed to get the oracle sequence done. However I ran into some Oracle Exception from my ASP.NET
ORA-06550: line 1, column 7:PLS-00703: multiple instances of named argument in list ORA-06550: line 1, column 7: PL/SQL: Statement ignored
when Save(). A quick check in C# business entity class (_MyClass.cs) reveals that the parameter \"TESTERTYPEID\" is created again despite that was already created as Input Parameter in CreateParameters() (see sample codes below). This cause 2 parameters of same name to exist, hence the Oracle exception. (A bug ??)
Code: Select all
   protected override DBCommandWrapper GetInsertCommand(CommandType commandType)
      {   
         DBCommandWrapper dbCommandWrapper;

         // Create the Database object, using the default database service. The
         // default database service is determined through configuration.
         Database db = GetDatabase();

         switch(commandType)
         {
            case CommandType.StoredProcedure:
               string sqlCommand = this.SchemaStoredProcedureWithSeparator + \"daab_AddTESTERTYPE\";
               dbCommandWrapper = db.GetStoredProcCommandWrapper(sqlCommand);

               dbCommandWrapper.AddParameter(\"TESTERTYPEID\", DbType.Int32, 0, ParameterDirection.Output, true, 0, 0, \"TESTERTYPEID\", DataRowVersion.Default, Convert.DBNull);
               CreateParameters(dbCommandWrapper);
               
               return dbCommandWrapper;


Question #2: A new record is created,how can I access the new recordID (e.g. rec.RecID) created by Oracle Sequence? I have seen 2 other posts on New Record ID but they are not for Oracle.
Code: Select all
MyRecord rec = new MyRecord();
rec.Remarks = \"I am new.\";
rec.Save();

int newRecID = rec.RecID;//returns 0.???
nead
Private First Class
 
Posts: 13
Joined: Wed May 24, 2006 3:14 am

Postby nead on Thu May 25, 2006 6:04 pm

Elaborating on my Question #2, in CreateParameters(),
>> if the parameter is created using AddParameter() with ParameterDirection.Output, the new recordID can be accessed.
>> If AddOutParameter() is used, new RecordID is returned as zero, weird isn't it?
>> (AddInParameter() also returns zero).
nead
Private First Class
 
Posts: 13
Joined: Wed May 24, 2006 3:14 am

Postby mgnoonan on Thu May 25, 2006 7:28 pm

Man, I've got to do a 1.2 release to fix these bugs.

I think the current code snapshot, available on the Tigris site, has this bug fixed. Your code example for accessing the newly created ID is correct, but the parameters are not being created properly so they don't get filled in.

I'll have to see about making a code snapshot available, but if you are comfortable with SVN you can retrieve the latest source code yourself. The instructions are on the EO homepage in the announcements. If you don't want to download it yourself, drop me an email and I will send you a zip with the latest code.
Matt Noonan
EasyObjects.NET - The O/RM for the Enterprise Library
http://www.easyobjects.net
User avatar
mgnoonan
Expert
 
Posts: 1019
Joined: Tue Sep 14, 2004 3:17 am
Location: Springboro, OH

Postby mgnoonan on Fri Oct 20, 2006 2:17 pm

nead,

I have been writing a bunch of NUnit tests for the upcoming 1.2 release of EO, and you were right: this is a problem. I have fixed it in the current code base (along with a bunch of other Oracle problems).

I know this is somewhat late for you, I apologize... :oops:
Matt Noonan
EasyObjects.NET - The O/RM for the Enterprise Library
http://www.easyobjects.net
User avatar
mgnoonan
Expert
 
Posts: 1019
Joined: Tue Sep 14, 2004 3:17 am
Location: Springboro, OH

Postby jamesshen on Wed Nov 08, 2006 12:16 pm

mgnoonan,
I have meet the same error with EO20CTP, pls fix it, thx.
jamesshen
Lurker
 
Posts: 3
Joined: Fri Aug 04, 2006 4:32 am

Postby mgnoonan on Wed Nov 08, 2006 1:18 pm

Hi James,

I haven't moved all the fixes into EO2 just yet, that will be my next step. It's coming soon!
Matt Noonan
EasyObjects.NET - The O/RM for the Enterprise Library
http://www.easyobjects.net
User avatar
mgnoonan
Expert
 
Posts: 1019
Joined: Tue Sep 14, 2004 3:17 am
Location: Springboro, OH


Return to EasyObjects.NET (Microsoft Enterprise Library)

Who is online

Users browsing this forum: No registered users and 2 guests