View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3821577#3821577

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3821577

Hallo,

I am learning ejb and I wrote some small application, which has stateless session 
bean, which works with bmp entity bean and cmp message driven bean.



So, from session bean I am calling finder method of entity bean. This method looking 
for users which data in some table is not validated yet, somethig as:

select distinct dealerid from sells where stateid = 4



I tried to create PK bean, but IDE do not allow it, it allows only String (or 
collection of String as return type - it is correct in BMP or not?).



So, method returns collection of string with values "dealerid" from database.

In session bean, I have:



Collection users = lh.findUsersToValidate();

for(Iterator it = users.iterator(); it.hasNext(); ){

        String user = (String)it.next().toString();

        LocalSells sells  = lh.findByPrimaryKey(user);

        ResultBean bean = sells.validateUsersSells(new UserPK(user));

}



but, as "user" value, I have there somethig as "local/sells:2195".



This code works, becouse in validateUsersSells() method I am get the "dealerid" from 
"user" 

(something as :

public int toUserId(){

        String[] _p = userId.split(":");

        return Integer.parseInt(_p[1]);

    }

)

but I know it is not good.



What is he correct way to work with it?

The next thing, I am calling findByPrimaryKey wit user parameter, which sets the 
dealerid to private variable in entity bean, but in next business method, in this 
variable is the first value, as:



LocalSells sells  = lh.findByPrimaryKey("local/sells:0001");

ResultBean bean = sells.validateUsersSells(new UserPK("local/sells:0001"));



- in sells the variable dealerid is set to 0001



in next step, I call 

LocalSells sells  = lh.findByPrimaryKey("local/sells:0002");

ResultBean bean = sells.validateUsersSells(new UserPK("local/sells:0002"));



and in sells is this variable setts still to 0001. Why? is it final variable (it is 
not defined as final manualy) or why?



Thanks,

Jiri


-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to