JBoss Community

EJB 3 Outside the Container.

created by R Saravana Prasad in Beginner's Corner - View the full document

Getting started on ejb3s outside the container:

 

The attached rar file has an application that uses ejb3 persistence outside the container

that can be run by from ant on command line.
Though the build script refers jars from jboss, jboss need not be running.

 

Persistence Provider:

 

Since a EJB 3.0 persistence layer is required, Hibernate is used as persistence provider.
Refer Persistence.xml file for configuration of Hibernate and build.xml for required JBoss and Hibernate lib files.

Uses annotations and no xml mapping files.

 

Required SQL Script:

 

1) Create a table om MS-SQL Server

        CREATE TABLE Product (
          productId INTEGER IDENTITY(1,1) NOT NULL PRIMARY KEY,
          productName varchar(25),
          productDescription varchar(25)
        );

 

2) select * from product

 

Ant sequence:

 

1) ant jar
2) ant -Dargs0=productName -Dargs1=productDescription run
-> this ant task creates a record and also lists all records after the latest insert.

 

Fire up the Jboss and pull up the app.

 

Saravana Prasad  R

Comment by going to Community

Create a new document in Beginner's Corner at Community