<[EMAIL PROTECTED]> wrote:
>I think you will find that the trick is use a 
> custom finder to return the collection of remote 
> objects directly from the (User) home interface.

  I was with the same problem of Brandon. Thanks to
him I can understant what is the problem.
  But the solution still is not clear to me.
  On the Brandon sample he had this :

  User user=home.findByPrimaryKey(id);
  System.out.println("name :"+user.getUsername());
  System.out.println("user id :"+user.getUserId());
  System.out.println("email
:"+user.getEmailAddress());
  Collection col=user.getPlaylists();
  
  Now it is clear the reason to this not work : this
was remote calls and getPlaylists() return a list of
local objects.
  What you are suggesting is use a finder method on
the user home like this ?

  Collection col = home.findPlayList(id);

  This can solve the query problem but how I can do
updates on the PlayList (using remote calls) ?
  My first idea was (now work of course) to do :

  User user=home.findByPrimaryKey(id);
  Collection col=user.getPlaylists();
  PlayListItem p= play_list_home.create("bla bla
bla");
  col.add(p);
  user.setPlayList(col);

  Another way is to make the relationship calling a
setUser method of the added PlayListItem :

  UserPK id = new UserPK("JOHN");
  User user=home.findByPrimaryKey(id);
  PlayListItem p= play_list_home.create("bla bla
bla");
  p.setUser(id);

  What is the best practice to do it ?

  Andre S.

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

_______________________________________________________________

Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to