Version 8

    Getting started on ejb3s outside the container:

     

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

    that can be run from ant on command line.  This can be used for unit test.
    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

    -> This ant task builds the application in a jar with META-INF/ containing the persistence.xml
    2) ant -Dargs0=productName -Dargs1=productDescription run

    -> this ant task creates a record with a product named productName and description as productDescription

    and also lists all records after the latest insert.

     

     

    Saravana Prasad  R