EJB 3.0 provides selection to embed JAVA POJO (Plain Old Java Object) into a creature bean and allows mapping column names with the method of the embedded POJO class. A java POJO to be embedded should be annotated as @Embeddable.
The beyond class can be embedded using @Embedded annotation.
Let us form a test EJB application to test embedded objects in EJB 3.0.
|1||Create a project with a nameEjbComponentunder a packagecom.tWisdomjobs.entityas explained in theEJB - Create Applicationchapter. Please use the project created inEJB - Persistencechapter as such for this chapter to understand embedded objects in EJB concepts.|
|2||CreatePublisher.javaunder packagecom.Wisdomjobs.entityas explained in theEJB - Create Applicationchapter. Keep rest of the files unchanged.|
|3||CreateBook.javaunder packagecom.Wisdomjobs.entity. UseEJB - Persistencechapter as reference. Keep rest of the files unchanged.|
|4||Clean and Build the application to make sure business logic is working as per the requirements.|
|5||Finally, deploy the application in the form of a jar file on JBoss Application Server. JBoss Application server will get started automatically if it is not started yet.|
|6||Now create the EJB client, a console based application in the same way as explained in theEJB - Create Applicationchapter under topicCreate Client to access EJB.|
EJBTester performs the following tasks −
Establish EJBTester.java in development explorer. Right click on EJBTester class and choose run file.
Verify the following output in Net beans console.
EJB(Enterprise JavaBeans) Related Interview Questions
|J2EE Interview Questions||Core Java Interview Questions|
|JDBC Interview Questions||JSP Interview Questions|
|Android Interview Questions||JMS(Java Message Service) Interview Questions|
|JavaServer Faces (JSF) Interview Questions||Java collections framework Interview Questions|
|Java 8 Interview Questions||Java Collections Interview Questions|
|Java Exception Handling Interview Questions||Java Concurrency Interview Questions|
|Java Serialization Interview Questions||Java Programmer Interview Questions|
|Java Inheritance Interview Questions||Java IO Interview Questions|
|Object Oriented Programming in PHP Interview Questions|
Ejb(enterprise Javabeans) Tutorial
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.