• Post Reply Bookmark Topic Watch Topic
  • New Topic

why not to create class in a package ?  RSS feed

 
Sameh Al-Sayed
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i wonder why it's not allowed to define classes in packages while developing an EJB ?
thnx
sameh
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ehm...what makes you think that? There's nothing in the spec. which stops you defining classes in packages.
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36446
454
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sameh,
In fact the opposite is true. You should create classes in a package.
 
Sameh Al-Sayed
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my dears ,
it's nothing i think about , it's in the specs,
not to define class in package for EJB's ,
by the way I'm SCBCD , and i just stoped at this point and didn't find any explaination for it, is there any ranchhands who can tell me,
it's in the objective 1 -env. restrictions- , or may be this is for the container's developer ?
i don't know
can u tell
sameh
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, if its in the specs. you should be able to tell us which spec. and which section this is defined in. Because I have the EJB2.1 spec open in front of me and not only is this not mentioned, but the examples listed in the spec. include just this practice! Are you possibly getting this from some certification study guide?
 
JeanLouis Marechaux
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you explain a bit further, and maybe copy/paste what you are referencing to in the EJB specs.
Because even if you are SCBCD, not to create classes within packages does not make sense (written as is)
 
Sameh Al-Sayed
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well i guess i didn't explain myself,
i meant that the bean must not define a class in a package,
i know that security issues are all handled by the container and using any security API's or any code that accesses security related objects will cause a problem,
so the case is that bean don't have to define class in a package for that
 
David Harkness
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sameh Al-Sayed:
i meant that the bean must not define a class in a package,
i know that security issues are all handled by the container...
What exactly does that first line mean? For me, and I believe 99% of the other people here, "defin[ing] a class in a package" means putting a line at the top of your class's source file that looks something like this:Since we all do this for our EJBs, there must be some other misunderstanding.

Can you quote something (text or example) to clarify?
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36446
454
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sameh,
I found this thread searching the archives of our SCBDC forum. It seems that this quote refers to the defineClass() method in the classloader. That makes sense because an EJB shouldn't be dealing with the classloader.

It doesn't preclude placing the EJB in a package, just from creating a new class at runtime.
 
Sameh Al-Sayed
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
exactly that's what i meant , may be i didn't explain myself good,
what i thought is that it's related to classloader but i wanted to make sure if i got it right,
i wasn't talking about static class definition at design time but i was talking about dynamic at runtime ,
execuse me if i didn't explain myself,
i'm not novic with programming -specially OOP- nor java ,
anyway thnx for all the replies.
 
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!