Menu

#1346 getEJBLocalObject() bug

v3.2
closed-duplicate
nobody
JBossCMP (436)
5
2003-05-23
2003-05-23
Federico
No

- Tested OS:
Win XP - service pack 1
SuSe Linux 8.0

- VM Sun 1.4.1_1

- SOFTWARE:
enterprise-server : jboss-3.2.1_tomcat-4.1.24 (on Win
XP - service pack 1 and SuSe Linux 8.0 )

database : mysql 4.0.12 (on Suse Linux 8.0)

driver for db : 3.0.6 mysql-connector

I got no exception stack, no error on the console, but
mismatched fields of a row comes out, because of the
getEJBLocalObject() to fetch a primary key of an auto
incremental key field after the bean has been passivated.
Before the time out everything is ok, after the time out I
got wrong datas.

The test I did to reproduce the bug has been a very
simple test:

A single table "test" on db with 3
fields "id_test" , "s_des_1" , "s_des_2"

An entity bean related to the table with no definition
of "id_test" cmp field, because an auto incremental key
field

In the entity bean i did the getId_test business method
to fetch the primary key in this way

public int getId_test()
{
final TestLocal test = (TestLocal)
context.getEJBLocalObject();
return ((Integer)test.getPrimaryKey()).intValue();
}

Then I created a stateless session bean that call a
findAll() method on the local home interface of the entity
to fetch the table rows and then copy the collection
result in a collection of javabeans.

The javabeans has the same three variables

int id_test
String s_des_1
String s_des_2

When in the session bean I set the id_test variable, I
call on the local interface the getId_test method of the
entity bean.

I call the session bean method from a servlet that pass
the collection to a jsp that show the table's rows on the
browser.

All is ok until i wait the time out period without do calls.

After timeout period the rows result corrupt: right
descrition (fetched by abstract method) but wrong
id_test (fetched by getEJBLocalObject().getPrimaryKey
()).

Not always the problem comes out but during my test it
is happened again.

I'm going to attach to this mail a .zip file with the .jar for
the EJBs (with sources) and a .war file for the servlet
and jsp (with sources).

Furthermore in the .zip file I put two .sql files to
generate table and test datas and a .doc file to describe
different results.

The last thing to say is that if I bypass the getId_test()
call by calling directly the getPrimaryKey() on the
Loacal interface instead of calling getId_test() method,
everything is ok.

This could be a sneaky problem, that people could not
see.

I hope to receive a reply from you.

Thanks a lot!

Federico

P.S. I forgot that with the jboss-3.2.0RC2_tomcat.4.1.18
is always ok.

Discussion

  • Scott M Stark

    Scott M Stark - 2003-05-23
    • status: open --> closed-duplicate
     
  • Scott M Stark

    Scott M Stark - 2003-05-23

    Logged In: YES
    user_id=175228

    This is a duplicate entry of 742197

     

Log in to post a comment.