• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to pack EJBs into jar

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

I'm learning EJB technology just from books, so please forgive me if this question doesn't make sense or answer is simple

I'm developing web application that uses EJB. I've about 25-30 entity beans, each in separate jar file. I've recently read that they should be organized into 'packs' of beans that work together.

I undestand, that when I've for example beans Currency and Account, they should be in one jar, as account contains currency code field (and I should create relationship?).

But the thing is more difficult to me in this situation. I have bean: AdminUser which contains data of admins. In most of my beans I've a fields where I should enter admin id - the one made change or created new object of given ejb type. So let's say: Category, Language, Item, Account. All of them are responsilble for something different and I see no reason for putting them into one jar. But each of them needs AdminUser bean. Putting AdminUser bean into each jar probably will produce an JNDI error when deploying. And even if this would be possible, when I'd like to make changes in AdminUser I'd have to change it in all jars.

Could anyone give me advice how should it look like? I don't have anyone who can help me and in books I can't find any complex enough projects.

Thanks in advance,
Michal
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35709
408
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michal,
The idea of having "packs" is to show logical groupings and make development/maintenance easier. Similar to the idea of encapsulation. I can think of 5 groups of beans easier than 30 individual beans.

Yes, Currency and Account would logically go together. It's up to you whether to create an EJB relationship.

It's ok to have a group of beans depend on another group on beans. It sounds like AdminUser is a higher level bean that depends on all or most of the others. You wouldn't have multiple copies of it. Rather you would have one that depends on the other ejb jars.
 
Edvins Reisons
Ranch Hand
Posts: 364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by M Glowacki:
in books I can't find any complex enough projects.


A good place to look for complexity is open source projects. JBoss, for example
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!