Need Help on EJB 2.1 call Oracle Sequence by passing SQL

Hi,

 

   Some body can give me some link, tutorial or sample code

   How in the EJB function there to get the connection to Database that can call Oracle Sequence like this

 

   GetSequenceID( SequenceName SN){

 

     sql="select "+SN +".nextval from dual";

 

    

     Connection conn = DBHelper.getConnection();

     

    stmt = conn.createStatement();

    rs = stmt.executeQuery(sql)

 

   }

 

  //DBHelper

  GetConenction(){

 

      

         Properties props=new Properties();

 

         props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");

 

         props.put(Context.PROVIDER_URL,"127.0.0.1:1099");           

 

         props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");

 

         InitialContext context=new InitialContext(props);

 

        

        Object obj = (new javax.naming.InitialContext()).lookup(JNDI_DATASOURCE);

       

        DataSource ds = (DataSource) obj;

        return ds.getConnection();

 

  } 

 

 

  How to define the JNDI_DATASOURCE??

  It is posible use xDoclet to generate it?

  What is the xDoclet command?

  

  My System Enviroment Here:

  a) JBOSS EAP 4.3

  b) EJB 2.1

  c) JDK 1.6