Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt about EJB Restrictions

 
Gowher Naik
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what does it mean?
The enterprise bean must not attempt to define a class in a package.

Thanks
 
Steven Colley
Ranch Hand
Posts: 290
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi gowher , how are you?

Ir means that your enterprise bean must be declared as PUBLIC!!!

see these samples below:

class MyBean implements SessionBean -- >class in package!!!
WRONG!!! It must be PUBLIC!!!

"public" class MyBean implements SessionBean -- >That's correct!!!

Hugs!!
 
Andor Nemeth
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The enterprise bean must not attempt to define a class in a package.


I think this statement is rather about the Reflection API or something like that...

With the Java Reflection API it's possible to do many "nasty", unusual things. For instance: accessing private class members! (Dependency injection is heavily based on this.)

This statement you've quoted (actually the EJB-container contract) prohibits some of these functions for the developer(bean provider).
That's why:

This function (defining a class in a package) is reserved for the EJB container. Allowing the enterprise bean to perform this function would create a security hole.


Correct me if I'm wrong!
Andor N�meth
[ August 07, 2007: Message edited by: Andor Nemeth ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic