• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

why not to create class in a package ?

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
i wonder why it's not allowed to define classes in packages while developing an EJB ?
thnx
sameh
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ehm...what makes you think that? There's nothing in the spec. which stops you defining classes in packages.
 
author & internet detective
Posts: 41071
848
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 41071
848
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Yup, yup, yup. Tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic