Thought inc.

The Dynamic O/R Mapping Company
     

CocoBase Technical Support Forums
For access to developer site with software download and doc's, please request CocoBase download and password
will be emailed to you. Response to posts will appear when answered by THOUGHT Support team.
NOTE:You must register separately with forum in order to post your questions, please click on register icon below.
Home   Frequently Asked Questions   Search   Edit your profile   Registration is free!  
Email This Page to Someone!
Show a Printable Version
CocoBase Enterprise O/R Forums > CocoBase Bug Reports
Bug in generated code in case of Association between 2 BMPs
< Previous Thread     Next Thread >
Author
Thread    Post New Thread     Post A Reply
sumit
Member

Registered: Apr 2001
Posts: 62

Hi,

Association:
-------------
When 1:Many link is created between 2 BMPs, CocoBase adds
a select<method suffix> method the BMP which returns array
of remote interface of the other BMP. We created link
between Dept and Employee. One dept can have many employees.
the method created in the Dept BMP was selectEmployee().
But the code written inside this has a problem. Code
generated inside this method is:

for(int i=0; i<v.size(); i++) {
lnk_Employee[i] = (EmployeeInterface)v.elementAt(i); }
return lnk_Emloyee;

This was giving us ClassCastException while we were testing the navigability in Visual Age for Java as well as in IBM WebSphere 3.5. We had to change the same and then it worked. The change is as follows:

for(int i=0; i<v.size(); i++) {
lnk_Employee[i] = (EmployeeInterface) javax.rmi.PortableRemoteObject.narrow(v.elementAt(i), EmployeeInterface.class); }
return lnk_Emloyee;

Please check this out as this requires manual intervention
in the code generation process.

04-26-2001 12:03 AM
Click Here to See the Profile for sumit    Find more posts by sumit        Edit/Delete Message    Reply w/Quote    IP: Logged
admin
Administrator

Registered: Apr 2001
Posts: 19

We've scheduled this for the next update, but you can change
the template yourself to do this cast by editing the
demos\resources\Webpshere3_5EBSP.properties at line 1888
so that this prevents you having to edit the resulting code...

The code would need to be changed to:

\t\t\t\t<CBINCLUDE LINKNAME>[i] = (%Targetclass%%BEAN_INTERFACE_SUFFIX%) javax.rmi.PortableRemoteObject.narrow(v.elementAt(i), %Targetclass%%BEAN_INTERFACE_SUFFIX%.class);%EOL%\

Hope this helps!

THOUGHT Support

04-26-2001 12:32 PM
Click Here to See the Profile for admin    Find more posts by admin        Edit/Delete Message    Reply w/Quote    IP: Logged
sumit
Member

Registered: Apr 2001
Posts: 62

Hi,

We faced this error in SR8, and you guys told me that this will get corrected in the next release. I assume that the next release was SR9 but we didn't find the change in the template file as told by you guys. Hence we are facing the same problem again. I thought you guys have taken care of this problem in SR9. Why this mismatch??

07-23-2001 08:45 AM
Click Here to See the Profile for sumit    Find more posts by sumit        Edit/Delete Message    Reply w/Quote    IP: Logged
admin
Administrator

Registered: Apr 2001
Posts: 19

Hmm...

This is in the SR11 update available from the website, but
you can apply the same update to your existing release if it
isn't possible for you to upgrade fully.

You can simply change the code template by searching for
v.elementAt in the Websphere3_5EBSP.properties template
and changing the line of code to:
\t\t\t\t<CBINCLUDE LINKNAME>[i] = (%Targetclass%%BEAN_INTERFACE_SUFFIX%) javax.rmi.PortableRemoteObject.narrow(v.elementAt(i), %Targetclass%%BEAN_INTERFACE_SUFFIX%.class);%EOL%\

This is the change we made for the shipping distribution and
should be in your release automatically...

THOUGHT Support

07-23-2001 07:17 PM
Click Here to See the Profile for admin    Find more posts by admin        Edit/Delete Message    Reply w/Quote    IP: Logged
sumit
Member

Registered: Apr 2001
Posts: 62

Hi,

Even after doing the narrow, we are facing ClassCastException inconsistently. We are getting this error when the element is being copied from the vector to the array i.e. at the following line

lnk_Employee[i] = (EmployeeInterface)v.elementAt(i);

This behavior is quite inconsistent as sometimes this works but sometimes it doesn't. What can be the reason for the same?

08-06-2001 09:20 AM
Click Here to See the Profile for sumit    Find more posts by sumit        Edit/Delete Message    Reply w/Quote    IP: Logged
admin
Administrator

Registered: Apr 2001
Posts: 19

This looks like you're using an older version of the code
templates. You might want to consider upgrading to the
new version, or if you can't you might want to consider merging
the template changes with your current release in regards to
navigation code...

THOUGHT Support

08-06-2001 11:09 AM
Click Here to See the Profile for admin    Find more posts by admin        Edit/Delete Message    Reply w/Quote    IP: Logged
All times are PST (US)    Post New Thread     Post A Reply
Forum Jump:
< Previous Thread     Next Thread >

Forum Rules:
Who Can Read The Forum? Any registered user or guest.
Who Can Post New Topics? Any registered user.
Who Can Post Replies? Any registered user.
Changes: Messages can be edited by their author. Messages can be deleted by their author.
Posts: HTML code is OFF. Smilies are OFF. vB code is OFF. [IMG] code is OFF.

Admin Options:
Open / Close Thread
Move Thread
Delete Thread
Edit Thread

< Contact Us - THOUGHT Inc. >

Copyright © Jelsoft Enterprises Limited 2000.
Copyright 2001 All Rights Reserved, THOUGHT Inc.