aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Annotations and EJB's Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Annotations and EJB Watch "Annotations and EJB New topic
Author

Annotations and EJB's

Jonah Kommu
Greenhorn

Joined: Mar 09, 2011
Posts: 12
Just started reading about the changes 3.x brings. And there might be questions that already explain this on the forum.
What all do annotations do under the hood for me. I assume they generate the boiler plate code (remote, home objects etc)

TIA !
J
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3837

They are an alternate way to configure EJBs and other related services provided by the container. You can use them over XML configuration if you prefer.

SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Yash Don
Greenhorn

Joined: May 19, 2010
Posts: 12
What all do annotations do under the hood for me. I assume they generate the boiler plate code (remote, home objects etc)


Actually annotation itself does not generate any boiler plate code for you. Annotations represnts the metadata associated with your class , attributes and methods. These are like preprocessors in C language. This metadata is used by the IDE, compiler and JVM (depending upon scope\retaintion policy of annotation) to extract additional information about class and attributes.

Check below tutorial for EJB 3

EJB 3 Tutorial

Regards,
Yash

SCJP, SCWCD
Jonah Kommu
Greenhorn

Joined: Mar 09, 2011
Posts: 12
This metadata is used by the IDE, compiler and JVM (depending upon scope\retaintion policy of annotation) to extract additional information about class and attributes.


Thanks for the response.
But would you be able to summarize how they are utilized and as to what the output is? Taking an example of a session bean.
Yash Don
Greenhorn

Joined: May 19, 2010
Posts: 12

Ok I will explain you the concept of annotation in EJB 3 with the help of below EJB example. This is a simple EJB for validating credit card number.
Here we are using two annotations. Stateless and Remote. These annotations will be first processed by a program called annotation processor that can read a Java program and take actions based on its annotations. So these annotions are nothing but the instructions to the EJB container. EJB container gives special treatment to this class becoz of the annotions.

Jonah Kommu
Greenhorn

Joined: Mar 09, 2011
Posts: 12
hese annotations will be first processed by a program called annotation processor that can read a Java program and take actions based on its annotations.


Thanks again.
So what ALL actions would have been taken in your example below..?

-- any objects boilerplate objects get created
-- any JNDI mapping that was done
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Annotations and EJB's