Playing with 10.2B eval and OOOERA classes. Is the code bugg

Posted by dhubbuck on 04-Feb-2010 04:21

Hi

I have started looking at the new 10.2B version of progress and like the new features of architect and the Gui for .NET.

One of the things we wish to do while modernising our app is to go to an appserver model and try and followsome of the OERA guidelines.

I have a sample screen which should fetch a list of customers via the OERA classes using fetchdata method.

This works for one request only.  If I try to use fetchdata again the system crashes anybody had these problems?

Sample code

contextCustomer =

NEW base.cltdatacontext().

Mycustomer =

NEW samples.pres.sacustomer().

hdsContext = contextCustomer:dsContext.

contextCustomer:setFilter(

'ttCustomer.name','begins','A').

/* Mycustomer:fetchData(OUTPUT DATASET dsCustomer BY-REFERENCE,

INPUT-OUTPUT DATASET-HANDLE hdsContext BY-REFERENCE). */

bsCustomer:

handle = DATASET dsCustomer:Handle.

GridCustomer:Datasource = BScustomer.

contextSalesArea =

NEW base.cltdatacontext().

hdsContextSalesArea = contextSalesArea:dsContext.

contextSalesArea:setFilter(

'ttSalesArea.area_code','begins','').

MysalesArea =

NEW samples.pres.saSalesArea().

MysalesArea:fetchData(

OUTPUT DATASET dsSalesArea BY-REFERENCE,

INPUT-OUTPUT DATASET-HANDLE hdsContextSalesArea BY-REFERENCE).

BSSalesArea:

handle = DATASET dsSalesArea:Handle.

GridSalesArea:Datasource = BSSalesArea.

If the top MyCustomer:fetchdata line is uncommited openedge crashes.

If I comment out the MysalesArea:FetchData and uncomment the MyCustomer:FetchData the grid with customers appear and vice versa.

Any ideas?

All Replies

Posted by jquerijero on 05-Feb-2010 14:55

Assign a query handle instead of a dataset handle to the binding source. There are some issues when using dataset handle.

Posted by dhubbuck on 08-Feb-2010 05:00

Hi Joseph

Thanks for the reply.

I tried assigning the query handle of the dataset and it made no difference.

Started debugging the code and found that if I added some message view-as alert-box statements within apicode.i sometimes it worked.  Which is very odd?

The bit of code I think is the offending line is the DELETE OBJECT contextInstance.

servicemgr:sessionContextService:setContextId(?).

/* message "aftersessioncontextService setcontextid {&PREFIX-NAME} {&COMPONENT-NAME}" view-as alert-box.*/

message "before delete object contextinstance {&PREFIX-NAME} {&COMPONENT-NAME}" view-as alert-box.

DELETE OBJECT contextInstance.

In the ServiceAdapter class I have

message "sa after_fetchdata.p" view-as alert-box.

I get a message before delete obejct contextinstance becustomer

I get a message sa after_fetchdata.p

I get a message before delete obejct contextinstance beSalesArea

I then get a progress client error.

Progress Client has encountered a problem and needs to close.  We are sorry for the inconvenience

I am working with local procedures and not remote appserver calls as I have not set up an appserver yet.

Cheers

Dale

Posted by jquerijero on 08-Feb-2010 13:54

What is inside contextInstance? You might be deleting resources that is still referenced by the UI.

Posted by Roger Blanchard on 08-Feb-2010 15:28

Dale,

You may want to try the new startup parameter -reusableObjects 0 which turns off the reusing of objects. There is a bug with this new feature and our application would constantly crash without this parameter.

Posted by dhubbuck on 09-Feb-2010 04:46

Hi Roger

Thanks for the reply

I have tried to add this startup parameter -reuseableObjects 0 to the AVM at the project level and also at the Window->Preferences->OpenEdge Architect->Startup level but I get an error when the AVM restarts saying the -e parameter requires an arqument greater than 0 (1404)

Also if I added -reusableObjects 1 then I got the error message 'could not recognise argument -useableObjects. (301)'.

Something very strange is going on.

I then added the stratup parameter to a run configuration and it seemd to start ok but I got the same progress client crash.

Cheers

Dale

Posted by Admin on 09-Feb-2010 04:54

Are you using a run/launch config that is still using 10.2A? (a common mistake that I make with migrated workspaces).

Posted by dhubbuck on 09-Feb-2010 05:35

Hi Mike

I have just checked the run config and it's set 10.2B.

I did have an old 10.2B beta system on the machine previously though.

Maybe a clean build may help.

Thanks

Dale

Posted by Roger Blanchard on 09-Feb-2010 06:05

It sounds like a version of OpenEdge that does not support that parameter is installed. I have been working with this parameter for a month and have tried it enabled at the project level and run configuration with ho issues. Is it possible the other copy you have on the machine is causing issues? Maybe your path pointing to the wrong directory?

Roger Blanchard

Posted by dhubbuck on 09-Feb-2010 07:50

I'll do a clean build and let you know how I get on.

Thanks

Posted by dhubbuck on 10-Feb-2010 03:51

I installed the 10.2B evaluation on a Windows 7 Professional Laptop and tried the -reusableObjects 0 startup parameter and I didn't get any errors regarding the startup parameter.  Progress still crashed when trying to call the fetchdata method of the sample OERA code though.

Posted by dhubbuck on 16-Feb-2010 06:08

I think I've narrowed my problem down to trying to delete objects that are still bound to another handle.

In the beCustomer_fetchdata.p routine.  The client context gets bound to the srvdatacontext.

contextInstance =

NEW base.srvdatacontext().

MESSAGE "Bfetchdata2 debug 2" view-as alert-box.

contextInstance:bindContext(

INPUT DATASET-HANDLE phdsContext BIND).

MESSAGE

"Bfetchdata2 debug 3" view-as alert-box.

This BIND seems to error.

This is after I commented out  the line of code that deleted the contextinstance.

DELETE OBJECT contextInstance.

WIth 10.2B is is possible to pass the client contextinstance object across as a parameter to the server.

My system might be crashing at the moment because I have no appserver running and using this code to create my happserver object.

CONSTRUCTOR

PUBLIC serviceadapter():

hAppServer =

IF VALID-HANDLE(SESSION:FIRST-SERVER)

THEN SESSION:FIRST-SERVER

ELSE SESSION:HANDLE.

END CONSTRUCTOR.

Are there any more examples of using OERA with classes?

Cheers

Dale

Posted by johncat on 24-Feb-2010 11:02

I had a similar problem.  After reading this thread I added the -reusableObjects 0 option to the 'Server startup parameters' on the AppServer and it seems to have cured it.

All the best,

John

Posted by Roger Blanchard on 24-Feb-2010 12:27

It definitely solved our application problem. We also use Roundtable and had to add this parameter to the appserver startup as well.

Roger Blanchard

Posted by dhubbuck on 08-Mar-2010 09:09

I tried the -reusableObjects 0 parameter and it had no effect but this was before I tried the code with the Appserver.

After trying with the parameter added to the Appserver startup the code worked fine.

Thanks

This thread is closed