• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB 3.0 Question

 
Arjun Reddy
Ranch Hand
Posts: 629
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I have a question. In EJB 2.0, we have this ejb-jar.xml file and no annotations right. Now, In EJB 3.0 we have annotations and I know that, what I don�t know or get confused is if

1). There is no ejb-jar.xml file at all since we are using annotations

(Or)

2). The ejb-jar.xml file need not be coded but is automatically generated.

Which one is true?/

Thanks.
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The ejb-jar.xml is not mandatory but is optional. The ejb-jar.xml will not be auto generated by the application server, but will have to be provided by your application.
 
Arjun Reddy
Ranch Hand
Posts: 629
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jaikiran Pai:
The ejb-jar.xml is not mandatory but is optional. The ejb-jar.xml will not be auto generated by the application server, but will have to be provided by your application.


Ok, so you are saying in EJB 3.0, having ejb-jar.xml file is optional and we can have it or not. But in EJB2.0, it is mandatory right?/

Thanks.
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Arjun Reddy:

Ok, so you are saying in EJB 3.0, having ejb-jar.xml file is optional and we can have it or not. But in EJB2.0, it is mandatory right?/



Yes, that's correct
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18100
51
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
EJB2 components can be compiled under JDK 1.4, which does not support annotations. One reason annotations were added to Java 5 was to eliminate the need for a separate metadata declarations file.

A lot of modern-day frameworks support both annotations and XML. In part, this is to allow backwards compatibility, but the XML is also a way to override the annotations. Unlike annotations, you don't have to have source code and recompile - just pack a new JAR, WAR, EAR or whatever. By using the XML you have the ability to tweak stuff that you've only been given binaries for.
 
Arjun Reddy
Ranch Hand
Posts: 629
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jaikiran and Tim
 
Vidyasagar Guduru
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually ejb-jar.xml file provides the metadata of the EJBs plus it also includes some other useful stuff like defining security roles, method permissions, transactions etc.

One of the advantages of the configuration/meta data files is without changing the actual application code we can change the application behavior by changing these property values.

Now if we move these settings to the annotations in the actual business components, do we need to change the components code, build and redeploy every time if there are any changes in those property values.
 
Ashwin Pai
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vidyasagar Guduru wrote:Actually ejb-jar.xml file provides the metadata of the EJBs plus it also includes some other useful stuff like defining security roles, method permissions, transactions etc.

One of the advantages of the configuration/meta data files is without changing the actual application code we can change the application behavior by changing these property values.

Now if we move these settings to the annotations in the actual business components, do we need to change the components code, build and redeploy every time if there are any changes in those property values.


Just to add to above post..
metadata config/deployment descriptors files are also a way to override annotations. For every xml tag in the ejb-jar.xml there is an equivalent annotation...

HTH
Ashwin
 
Vidyasagar Guduru
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I thought the other way that Annotations overwrite the configuration file settings.

Thanks.
 
narasimhudu kalva
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
I have a question . I know the IP Address and port number of another system which is running with sun app server. Now I want to access the methods from another client system in ejb 3.0. please tell the details of that properties file completely
 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi narasimhudu kalva,

This thread's last post is older than 7 months. Please post a new topic for your questions. And Welcome to Javaranch
 
narasimhudu kalva
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new for this site. I don't know what todo
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All you have to do is click on the "New topic" button in this forum and start a new topic to discuss your question.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic