Forums Register Login

EJB 3.0 Question

+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
 

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.
+Pie Number of slices to send: Send
 

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
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
Thanks Jaikiran and Tim
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
 

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
+Pie Number of slices to send: Send
Yes, I thought the other way that Annotations overwrite the configuration file settings.

Thanks.
+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
I am new for this site. I don't know what todo
+Pie Number of slices to send: Send
All you have to do is click on the "New topic" button in this forum and start a new topic to discuss your question.
Don't destroy the earth! That's where I keep all my stuff! Including this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 2132 times.
Similar Threads
JNDI names for EJBs
EJB 2.0 VS EJB 3.0
EJB in Action
annotations in ejb
stateless endpoint, how to make soap-fault exeption rollback enabled
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 00:00:30.