Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Performance / architecural question  RSS feed

 
Michal Glowacki
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Can't find answer to this question, as it's maybe more practical than theoretical. How should get data from connected beans, like those:

CategoryBean
-------------------
categoryId
categoryName


BookBean
----------------
bookId
categoryId
bookName


Right now in my code I do it like this (to reduce the code with ServiceLocator pattern) to get name of category which book belongs to.

-------------------------
ServiceLocator locator = ServiceLocator.getInstance();

BookHome bookHome = (BookHome)locator.getRemoteHome(
"BookRemote", BookHome.class);
CategoryHome catHome = (CategoryHome)locator.getRemoteHome(
"CategoryRemote", CategoryHome.class);
Book book = bookHome.findByPrimaryKey(bookId);
Category cat = catHome.findByPrimaryKey(book.getCategoryId());

String categoryName = cat.getCategoryName();

------------------------

I don't know if it's the proper way, does it affect performance? anything? I also tried to do this by making relations, but at least with small data sets I haven't noticed any performance improve.

Can anyone write sth about this?

Regards,
Michal
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!