Here is e that maps a PL/SQL package. More examples can be found in the Jpublisher 
documentation (see http://otn.oracle.com or www.oracle.com or the documentation cd 
that ships with Oracle RDBMS).

Bye, bye, Fabio.

/*********************** CODE START ****************************/


/[EMAIL PROTECTED]:filename=DALVoceDAO*//[EMAIL PROTECTED]:user-code*//[EMAIL 
PROTECTED]:1^1*/package it.ggs.iris.modello.jpub;

import java.sql.SQLException;
import sqlj.runtime.ref.DefaultContext;
import sqlj.runtime.ConnectionContext;
import java.sql.Connection;

public class DALVoceDAO
{

  /* connection management */
  protected DefaultContext __tx = null;
  protected Connection __onn = null;
  public void setConnectionContext(DefaultContext ctx) throws SQLException
  { release(); __tx = ctx; }
  public DefaultContext getConnectionContext() throws SQLException
  { if (__tx==null)
    { __tx = (__onn==null) ? DefaultContext.getDefaultContext() : new 
DefaultContext(__onn); }
    return __tx;
  };
  public Connection getConnection() throws SQLException
  { return (__onn==null) ? ((__tx==null) ? null : __tx.getConnection()) : __onn; }
  public void release() throws SQLException
  { if (__tx!=null && __onn!=null) __tx.close(ConnectionContext.KEEP_CONNECTION);
    __onn = null; __tx = null;
  }


  /* constructors */
  public DALVoceDAO() throws SQLException
  { __tx = DefaultContext.getDefaultContext();
 }
  public DALVoceDAO(DefaultContext c) throws SQLException
  { __tx = c; }
  public DALVoceDAO(Connection c) throws SQLException
  {__onn = c; __tx = new DefaultContext(c); }

  public DALVoci leggere (
    DSZChiaveSezione chiaveSezione[])
  throws SQLException
  {
    DALVoci __jPt_result;
    /[EMAIL PROTECTED]:generated-code*//[EMAIL PROTECTED]:43^5*/

//  ************************************************************
//  #sql [getConnectionContext()] __jPt_result = { VALUES(IRIS.DALK_VOCE.LEGGERE(
//        :chiaveSezione[0]))  };
//  ************************************************************

{
  // declare temps
  oracle.jdbc.OracleCallableStatement __sJT_st = null;
  sqlj.runtime.ref.DefaultContext __sJT_cc = getConnectionContext(); if 
(__sJT_cc==null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_CONN_CTX();
  sqlj.runtime.ExecutionContext.OracleContext __sJT_ec = 
((__sJT_cc.getExecutionContext()==null) ? 
sqlj.runtime.ExecutionContext.raiseNullExecCtx() : 
__sJT_cc.getExecutionContext().getOracleContext());
  try {
   __sJT_st = 
__sJT_ec.prepareOracleCall(__sJT_cc,"0it.ggs.iris.modello.jpub.DALVoceDAO","BEGIN :1 
:= IRIS.DALK_VOCE.LEGGERE(\n       :2 )  \n; END;");
   if (__sJT_ec.isNew())
   {
      __sJT_st.registerOutParameter(1,2003,"IRIS.DALO_VOCI");
      __sJT_st.registerOutParameter(2,2002,"IRIS.DSZO_CHIAVE_SEZIONE");
   }
   // set IN parameters
   if (chiaveSezione[0]==null) __sJT_st.setNull(2,2002,"IRIS.DSZO_CHIAVE_SEZIONE"); 
else __sJT_st.setORAData(2,chiaveSezione[0]);
   // execute statement
   __sJT_ec.oracleExecuteUpdate();
   // retrieve OUT parameters
   __jPt_result = 
(it.ggs.iris.modello.jpub.DALVoci)__sJT_st.getORAData(1,it.ggs.iris.modello.jpub.DALVoci.getORADataFactory());
   chiaveSezione[0] = 
(it.ggs.iris.modello.jpub.DSZChiaveSezione)__sJT_st.getORAData(2,it.ggs.iris.modello.jpub.DSZChiaveSezione.getORADataFactory());
  } finally { __sJT_ec.oracleClose(); }
}


//  ************************************************************

/[EMAIL PROTECTED]:user-code*//[EMAIL PROTECTED]:44^35*/
    return __jPt_result;
  }

  public void aggiornare (
    DSZChiaveSezione chiaveSezione[],
    DALVoci voci[])
  throws SQLException
  {
    /[EMAIL PROTECTED]:generated-code*//[EMAIL PROTECTED]:53^5*/

//  ************************************************************
//  #sql [getConnectionContext()] { CALL IRIS.DALK_VOCE.AGGIORNARE(
//        :chiaveSezione[0],
//        :voci[0])  };
//  ************************************************************

{
  // declare temps
  oracle.jdbc.OracleCallableStatement __sJT_st = null;
  sqlj.runtime.ref.DefaultContext __sJT_cc = getConnectionContext(); if 
(__sJT_cc==null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_CONN_CTX();
  sqlj.runtime.ExecutionContext.OracleContext __sJT_ec = 
((__sJT_cc.getExecutionContext()==null) ? 
sqlj.runtime.ExecutionContext.raiseNullExecCtx() : 
__sJT_cc.getExecutionContext().getOracleContext());
  try {
   __sJT_st = 
__sJT_ec.prepareOracleCall(__sJT_cc,"1it.ggs.iris.modello.jpub.DALVoceDAO","BEGIN 
IRIS.DALK_VOCE.AGGIORNARE(\n       :1 ,\n       :2 ) \n; END;");
   if (__sJT_ec.isNew())
   {
      __sJT_st.registerOutParameter(1,2002,"IRIS.DSZO_CHIAVE_SEZIONE");
      __sJT_st.registerOutParameter(2,2003,"IRIS.DALO_VOCI");
   }
   // set IN parameters
   if (chiaveSezione[0]==null) __sJT_st.setNull(1,2002,"IRIS.DSZO_CHIAVE_SEZIONE"); 
else __sJT_st.setORAData(1,chiaveSezione[0]);
   if (voci[0]==null) __sJT_st.setNull(2,2003,"IRIS.DALO_VOCI"); else 
__sJT_st.setORAData(2,voci[0]);
   // execute statement
   __sJT_ec.oracleExecuteUpdate();
   // retrieve OUT parameters
   chiaveSezione[0] = 
(it.ggs.iris.modello.jpub.DSZChiaveSezione)__sJT_st.getORAData(1,it.ggs.iris.modello.jpub.DSZChiaveSezione.getORADataFactory());
   voci[0] = 
(it.ggs.iris.modello.jpub.DALVoci)__sJT_st.getORAData(2,it.ggs.iris.modello.jpub.DALVoci.getORADataFactory());
  } finally { __sJT_ec.oracleClose(); }
}


//  ************************************************************

/[EMAIL PROTECTED]:user-code*//[EMAIL PROTECTED]:55^25*/
  }
}/[EMAIL PROTECTED]:generated-code*/


/*********************** CODE END ****************************/
 

> -----Messaggio originale-----
> Da: CRANFORD, CHRIS [mailto:[EMAIL PROTECTED] 
> Inviato: mercoledì 30 giugno 2004 04:28
> A: 'Struts Users Mailing List'
> Oggetto: RE: Struts and PL/SQL
> 
> 
> I would be interested in seeing what one of these generated 
> Java classes
> look like internally?  Care to post an example?
> Chris
> 
> -----Original Message-----
> From: Grassi Fabio [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, June 24, 2004 5:31 AM
> To: Lucas Gonzalez; Struts Users Mailing List
> Subject: R: Struts and PL/SQL
> 
> 
> Hi, in my application all DB access goes through PL/SQL 
> stored procedures. I
> use Oracle JPublisher to generate the Java classes that map 
> PL/SQL packages.
> It works fine enough.
> 
> Bye, Fabio.
> 
> > -----Messaggio originale-----
> > Da: Lucas Gonzalez [mailto:[EMAIL PROTECTED]
> > Inviato: mercoledì 23 giugno 2004 20:07
> > A: Struts Users Mailing List
> > Oggetto: Struts and PL/SQL
> > 
> > 
> > Hi all!
> > 
> > I´ve been using Struts a lot with EJB and Hibernate with no 
> problems.
> > 
> > But I always wondered if it´s possible to use an architecture
> > that uses
> > STRUTS and goes directly to PL/SQL for the database layer. I 
> > know it is
> > possible in many way, but I would like to know if there is 
> any special
> > product or package that integrates with PL ( the only one I found is
> > http://portalstudio.oracle.com/servlet/page?_pageid=473&_dad=o
> ps&_schema=OPSTUDIO ) ... any pointers?
> 
> Thanks a lot
> Lucas
> 
> Ai sensi del D.Lgs. 196/2003 si precisa che le informazioni 
> contenute in
> questo messaggio sono riservate ed a uso esclusivo del 
> destinatario. Qualora
> il messaggio in parola Le fosse pervenuto per errore, La invitiamo ad
> eliminarlo senza copiarlo e a non inoltrarlo a terzi, 
> dandocene gentilmente
> comunicazione. Grazie.<BR><BR>Pursuant to Legislative Decree 
> No. 196/2003,
> you are hereby informed that this message contains 
> confidential information
> intended only for the use of the addressee. If you are not 
> the addressee,
> and have received this message by mistake, please delete it 
> and immediately
> notify us. You may not copy or disseminate this message to 
> anyone. Thank
> you.
> 
Ai sensi del D.Lgs. 196/2003 si precisa che le informazioni contenute in questo 
messaggio sono riservate ed a uso esclusivo del destinatario. Qualora il messaggio in 
parola Le fosse pervenuto per errore, La invitiamo ad eliminarlo senza copiarlo e a 
non inoltrarlo a terzi, dandocene gentilmente comunicazione. Grazie.<BR><BR>Pursuant 
to Legislative Decree No. 196/2003, you are hereby informed that this message contains 
confidential information intended only for the use of the addressee. If you are not 
the addressee, and have received this message by mistake, please delete it and 
immediately notify us. You may not copy or disseminate this message to anyone. Thank 
you.

Reply via email to