Re: mysql autoincrement pk

José Manuel Molina Pascual <[email protected]>
Newsgroups gmane.comp.java.ejb.middlegen.user
Organization Stratesys Consulting
Message-ID <[email protected]>
Ok, here it goes, I paste the relevant code and and attach the files and 
its xdoclet build file.

Here's the exception I get, well, actually, I debugged the jboss 
execution and the  FacturaLocal object is not null but is not the entity 
just created.

It seems to me that it passes the if condition !!!!!! but somehow  its 
not usefull

org.jboss.tm.JBossTransactionRolledbackException: Attempt to get lock 
ref with a null object; CausedByException is:
    Attempt to get lock ref with a null object; nested exception is:
    java.lang.IllegalArgumentException: Attempt to get lock ref with a 
null object; - nested throwable: (java.lang.IllegalArgumentException: 
Attempt to get lock ref with a null object)
    at 
org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:262)
    at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:195)
    at 
org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
    at 
org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:322)
    at org.jboss.ejb.Container.invoke(Container.java:674)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at 
org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
    at 
org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:359)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
    at sun.rmi.transport.Transport$1.run(Transport.java:148)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
    at 
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
    at 
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
    at java.lang.Thread.run(Thread.java:534)
Caused by: java.lang.IllegalArgumentException: Attempt to get lock ref 
with a null object
    at org.jboss.ejb.BeanLockManager.getLock(BeanLockManager.java:80)
    at 
org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:81)
    at 
org.jboss.ejb.plugins.EntityCreationInterceptor.invoke(EntityCreationInterceptor.java:53)
    at 
org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
    at 
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:243)
    at 
org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:104)
    at 
org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:117)
    at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
    at 
org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
    at 
org.jboss.ejb.EntityContainer.internalInvoke(EntityContainer.java:483)
    at org.jboss.ejb.Container.invoke(Container.java:674)
    at 
org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:353)
    at org.jboss.ejb.plugins.local.EntityProxy.invoke(EntityProxy.java:38)
    at $Proxy84.getPkfactura(Unknown Source)
    at 
gcc.fac.wrp.FacturacionWrapperBean.insertarFactura(FacturacionWrapperBean.java:173)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at 
org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:629)
    at 
org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
    at 
org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
    at 
org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
    at 
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:243)
    at 
org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:104)
    at 
org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:117)
    at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
    ... 21 more



####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################





Relevant code in FacturacionWrapperBean, the method
    /**
     * @param factura
     * @return
     * @throws NamingException
     * @throws RemoteException
     * @throws CreateException
     * @throws FinderException
     *  @ejb.interface-method view-type = "remote"
     */
    public Boolean insertarFactura( gcc.fac.jdo.Factura factura) throws 
NamingException, RemoteException, CreateException,FinderException {
        Boolean resultado = null;
        FacturaLocal facturaLocal;
        FacturaLocalHome facturaLocalHome;
        ConceptoLocal conceptoLocal;
        ConceptoLocalHome conceptoLocalHome;
        Concepto[] conceptos;
       

        facturaLocalHome = FacturaUtil.getLocalHome();
        conceptoLocalHome = ConceptoUtil.getLocalHome();
        Calendar fechaCal;
        if (factura.getFecha() != null){
            fechaCal = factura.getFecha();
        }else{
            fechaCal = Calendar.getInstance();
        }
        Date fecha = new Date(fechaCal.getTimeInMillis());
       
       
       
        byte pagada = Util.boolean2Byte(factura.getPagada().booleanValue());
        byte albaran = 
Util.boolean2Byte(factura.getAlbaran().booleanValue());
        Long b = new Long(1);
       
        facturaLocal = 
facturaLocalHome.create(factura.getNombreCliente(),factura.getDirCliente(),factura.getObservaciones(),pagada,factura.getTipoPago(),null
            
,factura.getCodigoFactura(),factura.getPKPaciente().longValue(),fecha,factura.getDNICliente()
            
,factura.getCPCliente().intValue(),factura.getCiudadCliente(),factura.getProvinciaCliente(),factura.getPaisCliente(),albaran,0);
               
        //facturaLocal = (FacturaLocal) 
facturaLocalHome.findByCodigoFactura(factura.getCodigoFactura()).iterator().next();
        System.out.println("insert parent passed");
        if(facturaLocal.getPkfactura()!= null){ //I dont know how it 
manages to pass this condition, anyway, it does not print nothing in the 
server output.
            System.out.println(facturaLocal.getPkfactura().toString());
            conceptos = factura.getConceptos();
            if (conceptos != null){
                for (int i=0; i< conceptos.length; i++){               
                    
conceptoLocalHome.create(conceptos[i].getDescripcion(),conceptos[i].getPrecio().doubleValue(),
                    conceptos[i].getPctImpuestos().doubleValue(),null,0,
                    conceptos[i].getCantidad().intValue(),facturaLocal);
                }
            }
        }
       
        return resultado;
    }


####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################




The create methods in ConceptoBean

   /**
    * This create method takes only mandatory (non-nullable) parameters.
    *
    * When the client invokes a create method, the EJB container invokes 
the ejbCreate method.
    * Typically, an ejbCreate method in an entity bean performs the 
following tasks:
    * <UL>
    * <LI>Inserts the entity state into the database.</LI>
    * <LI>Initializes the instance variables.</LI>
    * <LI>Returns the primary key.</LI>
    * </UL>
    *
    * @param concepto the concepto value
    * @param valor the valor value
    * @param impuestos the impuestos value
    * @param pkconcepto the pkconcepto value
    * @param cantidad the cantidad value
    * @param factura mandatory CMR field
    * @return the primary key of the new instance
    *
    * @ejb.create-method
    */
   public gcc.fac.ejb.ConceptoPK ejbCreate( java.lang.String concepto, 
double valor, double impuestos, java.lang.Long pkconcepto, int cantidad, 
gcc.fac.ejb.FacturaLocal factura ) throws javax.ejb.CreateException {
      // Set CMP fields
      setConcepto(concepto);
      setValor(valor);
      setImpuestos(impuestos);
      setPkconcepto(pkconcepto);
      setCantidad(cantidad);
      setPkfactura(factura.getPkfactura());
      // EJB 2.0 spec says return null for CMP ejbCreate methods.
      return null;
   }

   /**
    * The container invokes thos method immediately after it calls 
ejbCreate.
    *
    * @param concepto the concepto value
    * @param valor the valor value
    * @param impuestos the impuestos value
    * @param pkconcepto the pkconcepto value
    * @param cantidad the cantidad value
    * @param factura mandatory CMR field
    */
   public void ejbPostCreate( java.lang.String concepto, double valor, 
double impuestos, java.lang.Long pkconcepto, int cantidad, 
gcc.fac.ejb.FacturaLocal factura ) throws javax.ejb.CreateException {
      // Set CMR fields
      setFactura(factura);
   }

   /**
    * This create method takes all parameters (both nullable and not 
nullable).
    *
    * When the client invokes a create method, the EJB container invokes 
the ejbCreate method.
    * Typically, an ejbCreate method in an entity bean performs the 
following tasks:
    * <UL>
    * <LI>Inserts the entity state into the database.</LI>
    * <LI>Initializes the instance variables.</LI>
    * <LI>Returns the primary key.</LI>
    * </UL>
    *
    * @param concepto the concepto value
    * @param valor the valor value
    * @param impuestos the impuestos value
    * @param pkconcepto the pkconcepto value
    * @param pkintervencion the pkintervencion value
    * @param cantidad the cantidad value
    * @param factura CMR field
    * @return the primary key of the new instance
    *
    * @ejb.create-method
    */
   public gcc.fac.ejb.ConceptoPK ejbCreate( java.lang.String concepto, 
double valor, double impuestos,  java.lang.Long pkconcepto, long 
pkintervencion, int cantidad, gcc.fac.ejb.FacturaLocal factura ) throws 
javax.ejb.CreateException {
      // Set CMP fields
      setConcepto(concepto);
      setValor(valor);
      setImpuestos(impuestos);
      setPkconcepto(pkconcepto);
      setPkintervencion(pkintervencion);
      setCantidad(cantidad);
    setPkfactura(factura.getPkfactura());
      // EJB 2.0 spec says return null for CMP ejbCreate methods.
      return null;
   }


####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################



The create methods on FacturaBean

   /**
    * This create method takes only mandatory (non-nullable) parameters.
    *
    * When the client invokes a create method, the EJB container invokes 
the ejbCreate method.
    * Typically, an ejbCreate method in an entity bean performs the 
following tasks:
    * <UL>
    * <LI>Inserts the entity state into the database.</LI>
    * <LI>Initializes the instance variables.</LI>
    * <LI>Returns the primary key.</LI>
    * </UL>
    *
    * @param observaciones the observaciones value
    * @param pagada the pagada value
    * @param tipoPago the tipoPago value
    * @param pkfactura the pkfactura value
    * @param fecha the fecha value
    * @return the primary key of the new instance
    *
    * @ejb.create-method
    */
   public gcc.fac.ejb.FacturaPK ejbCreate( java.lang.Object 
observaciones, byte pagada, java.lang.String tipoPago, java.lang.Long 
pkfactura, java.sql.Date fecha ) throws javax.ejb.CreateException {
      // Set CMP fields
      setObservaciones(observaciones);
      setPagada(pagada);
      setTipoPago(tipoPago);
      setPkfactura(pkfactura);
      setFecha(fecha);
      // EJB 2.0 spec says return null for CMP ejbCreate methods.
      return null;
   }

   /**
    * The container invokes thos method immediately after it calls 
ejbCreate.
    *
    * @param observaciones the observaciones value
    * @param pagada the pagada value
    * @param tipoPago the tipoPago value
    * @param pkfactura the pkfactura value
    * @param fecha the fecha value
    */
   public void ejbPostCreate( java.lang.Object observaciones, byte 
pagada, java.lang.String tipoPago, java.lang.Long pkfactura, 
java.sql.Date fecha ) throws javax.ejb.CreateException {
      // Set CMR fields
   }

   /**
    * This create method takes all parameters (both nullable and not 
nullable).
    *
    * When the client invokes a create method, the EJB container invokes 
the ejbCreate method.
    * Typically, an ejbCreate method in an entity bean performs the 
following tasks:
    * <UL>
    * <LI>Inserts the entity state into the database.</LI>
    * <LI>Initializes the instance variables.</LI>
    * <LI>Returns the primary key.</LI>
    * </UL>
    *
    * @param nombreCliente the nombreCliente value
    * @param dirCliente the dirCliente value
    * @param observaciones the observaciones value
    * @param pagada the pagada value
    * @param tipoPago the tipoPago value
    * @param pkfactura the pkfactura value
    * @param codigoFactura the codigoFactura value
    * @param pkpaciente the pkpaciente value
    * @param fecha the fecha value
    * @param dnicliente the dnicliente value
    * @param cpcliente the cpcliente value
    * @param ciudadCliente the ciudadCliente value
    * @param provinciaCliente the provinciaCliente value
    * @param paisCliente the paisCliente value
    * @param albaran the albaran value
    * @param pkcita the pkcita value
    * @return the primary key of the new instance
    *
    * @ejb.create-method
    */
   public gcc.fac.ejb.FacturaPK ejbCreate( java.lang.String 
nombreCliente, java.lang.String dirCliente, java.lang.Object 
observaciones, byte pagada, java.lang.String tipoPago, java.lang.Long 
pkfactura, java.lang.String codigoFactura, long pkpaciente, 
java.sql.Date fecha, java.lang.String dnicliente, int cpcliente, 
java.lang.String ciudadCliente, java.lang.String provinciaCliente, 
java.lang.String paisCliente, byte albaran, long pkcita ) throws 
javax.ejb.CreateException {
      // Set CMP fields
      setNombreCliente(nombreCliente);
      setDirCliente(dirCliente);
      setObservaciones(observaciones);
      setPagada(pagada);
      setTipoPago(tipoPago);
      setPkfactura(pkfactura);
      setCodigoFactura(codigoFactura);
      setPkpaciente(pkpaciente);
      setFecha(fecha);
      setDnicliente(dnicliente);
      setCpcliente(cpcliente);
      setCiudadCliente(ciudadCliente);
      setProvinciaCliente(provinciaCliente);
      setPaisCliente(paisCliente);
      setAlbaran(albaran);
      setPkcita(pkcita);
      // EJB 2.0 spec says return null for CMP ejbCreate methods.
      return null;
   }

   /**
    * The container invokes thos method immediately after it calls 
ejbCreate.
    *
    * @param nombreCliente the nombreCliente value
    * @param dirCliente the dirCliente value
    * @param observaciones the observaciones value
    * @param pagada the pagada value
    * @param tipoPago the tipoPago value
    * @param pkfactura the pkfactura value
    * @param codigoFactura the codigoFactura value
    * @param pkpaciente the pkpaciente value
    * @param fecha the fecha value
    * @param dnicliente the dnicliente value
    * @param cpcliente the cpcliente value
    * @param ciudadCliente the ciudadCliente value
    * @param provinciaCliente the provinciaCliente value
    * @param paisCliente the paisCliente value
    * @param albaran the albaran value
    * @param pkcita the pkcita value
    */
   public void ejbPostCreate( java.lang.String nombreCliente, 
java.lang.String dirCliente, java.lang.Object observaciones, byte 
pagada, java.lang.String tipoPago, java.lang.Long pkfactura, 
java.lang.String codigoFactura, long pkpaciente, java.sql.Date fecha, 
java.lang.String dnicliente, int cpcliente, java.lang.String 
ciudadCliente, java.lang.String provinciaCliente, java.lang.String 
paisCliente, byte albaran, long pkcita ) throws javax.ejb.CreateException {
      // Set CMR fields
   }

 
Timothy Peter Cockle wrote:

>Sounds odd as the create should return the entity bean.
>Attach the relevant code and build file.
>
>Tim
>On Thu, 2004-01-22 at 11:23, José Manuel Molina Pascual wrote:
>  
>
>>Hy,
>>
>>I'm used middlegen to generate code from a database schema, I has
>>InnoDB tables into a mysql database, 
>>
>>In particular, I have one table with an autoincrement pk field (well,
>>in fact, all the tables have an autoincrement pk field), wich is
>>causing me some problems.
>>
>>This table, has a child table (1 - 0..N Relation)   well, thay work
>>fairly well if you create first one row int he parent table, then you
>>manage to get its local instance (I call them from a session bean, so
>>I use the local interfaces), and then insert the childs wioth this
>>local object in the create call.
>>
>>The problem arises as, from the client app, the user can create a new
>>structure (a new parent with new childs) and then I need to create the
>>parent (this step its ok) an then get this newly created parent and
>>insert the childs, this second step is what is causing me problems.
>>
>>First, the aprent create method returns me null, The bean returns a
>>PKFactura (the table is called Factura) but the method in the
>>localhome interface (generated with XDoclet using the tgas generated
>>with middlegen) returns a FacturaLocalHome object, I thinks its ok as
>>Jbosss deploys it ok and I don't know what the specification says
>>about this, anyway, as I said the create method returns null, nor the
>>PK nor the newly created entity.
>>
>>So, here arises the problem, I have no way to get this entity without
>>user intervention, as no other field is unique, I dont know the pk the
>>mysql engine asigned the new parent row.
>>
>>The only way i think I have to get the pk it with the SELECT
>>LAST_INSERTED_ID() SQL sentence, I havent tested yet but I'm not sure
>>it will work as as far as I know:
>>      * It returns the last inserted autoincrement value on a
>>        connection base, so if Jboss doesn't employ the same
>>        connection to insert the parents and the childs, i wont do, or
>>        if the same connection is used by jboss to insert one parent,
>>        then another parent , then the childs from the first
>>        parent.........    it won't do.
>>In fact I'm not sure about the behaviour of jboss at this point, th
>>parent and the childs, are inserted in the same method of the wrapper
>>session bean, maybe, its done into one transaction, and so inside the
>>same connection.
>>
>>
>>Well, does anyone knows if the LAST_INSERTED_ID() aproach will
>>do????????
>>
>>
>>-- 
>>José Manuel Molina Pascual
>>
>>[email protected]
>>
>>Stratesys Consulting 
>>C/ Juan de Mena, 6
>>Madrid 28014
>>Tel (+34) 91 360 49 60
>>
>>    
>>
>
>
>
>-------------------------------------------------------
>The SF.Net email is sponsored by EclipseCon 2004
>Premiere Conference on Open Tools Development and Integration
>See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
>http://www.eclipsecon.org/osdn
>_______________________________________________
>middlegen-user mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/middlegen-user
>
>
>
>  
>


-- 
José Manuel Molina Pascual
[email protected] <mailto:[email protected]>
/*
Stratesys Consulting */
C/ Juan de Mena, 6
Madrid 28014
Tel (+34) 91 360 49 60
FacturacionWrapperBean.java (text/plain, 6.9 KB)
/*
 * fichero : FacturacionWrapperBean.java
 * 
 * Creada el 31-dic-2003
 * 
 * Proyecto : GestionClinica
 * 
 * Paquete : gcc.fac.wrp
 *
 * Autor: José Manuel Molina Pascual
 * 
 *
 */
package gcc.fac.wrp;


import gcc.bas.Util;
import gcc.fac.ejb.ConceptoLocal;
import gcc.fac.ejb.ConceptoLocalHome;
import gcc.fac.ejb.ConceptoUtil;
import gcc.fac.ejb.FacturaLocal;
import gcc.fac.ejb.FacturaLocalHome;
import gcc.fac.ejb.FacturaPK;
import gcc.fac.ejb.FacturaUtil;
import gcc.fac.jdo.Concepto;
import gcc.fac.jdo.FacGenerator;

import java.rmi.RemoteException;
import java.sql.Date;
import java.util.Calendar;
import java.util.ResourceBundle;

import javax.ejb.CreateException;
import javax.ejb.EJBException;
import javax.ejb.FinderException;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import javax.naming.NamingException;



/**
 * @author jmmolina
 *
 * To change the template for this generated type comment go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
/**
 * @author jmmolina
 *
 * To change the template for this generated type comment go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
/**
 * @author jmmolina
 *
 * To change the template for this generated type comment go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */



/**
 * @ejbHome <{gcc.fac.wrp.FacturacionWrapperHome}>
 * @ejbRemote <{gcc.fac.wrp.FacturacionWrapper}>
 * @ejb.bean 	name = "FacturacionWrapper"
 * 				display-name = "FacturacionWrapper"
 * 				type = "Stateless"
 * 				view-type = "remote"
 * 				jndi-name = "FacturacionWrapper"
 * 				transaction-type = "Container"
 * 
 * @ejb.home remote-class = "gcc.fac.wrp.FacturacionWrapperHome"
 * 
 * @ejb.interface remote-class = "gcc.fac.wrp.FacturacionWrapper"
 * 
 * 					 			
 * @ejb.transaction type = "Required"
 * 
 */



 
public class FacturacionWrapperBean implements SessionBean {
	private SessionContext ctx;
	private String dbName = null;
	private ResourceBundle props = null;
	public static String COMP_NAME = "gcc.fac.ejb.FacturacionWrapperBean";

	public void setSessionContext(SessionContext context) throws RemoteException, EJBException {
		ctx = context;
	}

	public void ejbActivate() throws EJBException {
	}

	public void ejbPassivate() throws EJBException {
	}

	public void ejbRemove() throws EJBException {
	}
	/**
	 * 
	 * @throws CreateException
	 * @throws EJBException
	 * 
	 * @ejb.create-method
	 */
	public void ejbCreate() throws CreateException, EJBException {
		// Write your code here
		this.props = ResourceBundle.getBundle("gcc.AdvPropiedades");
		this.dbName = props.getString("baseDatosClinica");
	}

	/**
	 * @param PKPaciente
	 * @return
	 * @throws NamingException
	 * @throws RemoteException
	 * @throws CreateException
	 * @throws FinderException
	 *  @ejb.interface-method view-type = "remote"
	 */
	public gcc.fac.jdo.Factura buscarFacturasPaciente(Integer PKPaciente, Calendar fechaIni, Calendar fechaFin) throws NamingException, RemoteException, CreateException,FinderException {	
		gcc.fac.jdo.Factura  facturaJdo= null;
		FacturaLocalHome home = FacturaUtil.getLocalHome();
		FacturaLocal factura = (FacturaLocal) home.findByPkpaciente(PKPaciente.longValue()).iterator().next();
		facturaJdo = FacGenerator.getJdo(factura);
		return facturaJdo;
	}
	
	/**
	 * @param factura
	 * @return
	 * @throws NamingException
	 * @throws RemoteException
	 * @throws CreateException
	 * @throws FinderException
	 *  @ejb.interface-method view-type = "remote"
	 */
	public Boolean insertarFactura( gcc.fac.jdo.Factura factura) throws NamingException, RemoteException, CreateException,FinderException {
		Boolean resultado = null;
		FacturaLocal facturaLocal;
		FacturaLocalHome facturaLocalHome;
		ConceptoLocal conceptoLocal;
		ConceptoLocalHome conceptoLocalHome;
		Concepto[] conceptos;
		

		facturaLocalHome = FacturaUtil.getLocalHome();
		conceptoLocalHome = ConceptoUtil.getLocalHome();
		Calendar fechaCal;
		if (factura.getFecha() != null){
			fechaCal = factura.getFecha();
		}else{
			fechaCal = Calendar.getInstance();
		}
		Date fecha = new Date(fechaCal.getTimeInMillis());
		
		
		
		byte pagada = Util.boolean2Byte(factura.getPagada().booleanValue());
		byte albaran = Util.boolean2Byte(factura.getAlbaran().booleanValue());
		Long b = new Long(1); 
		
		facturaLocal = facturaLocalHome.create(factura.getNombreCliente(),factura.getDirCliente(),factura.getObservaciones(),pagada,factura.getTipoPago(),null
			,factura.getCodigoFactura(),factura.getPKPaciente().longValue(),fecha,factura.getDNICliente()
			,factura.getCPCliente().intValue(),factura.getCiudadCliente(),factura.getProvinciaCliente(),factura.getPaisCliente(),albaran,0);
				
		//facturaLocal = (FacturaLocal) facturaLocalHome.findByCodigoFactura(factura.getCodigoFactura()).iterator().next();
		System.out.println("insert parent passed");
		if(facturaLocal.getPkfactura()!= null){
			System.out.println(facturaLocal.getPkfactura().toString());
			conceptos = factura.getConceptos();
			if (conceptos != null){
				for (int i=0; i< conceptos.length; i++){				
					conceptoLocalHome.create(conceptos[i].getDescripcion(),conceptos[i].getPrecio().doubleValue(),
					conceptos[i].getPctImpuestos().doubleValue(),null,0,
					conceptos[i].getCantidad().intValue(),facturaLocal);
				}
			}
		}
		
		return resultado;
	}
	
	/**
	 * @param factura
	 * @return
	 * @throws NamingException
	 * @throws RemoteException
	 * @throws CreateException
	 * @throws FinderException
	 *  @ejb.interface-method view-type = "remote"
	 */
	public Boolean modificarFactura( gcc.fac.jdo.Factura factura) throws NamingException, RemoteException, CreateException,FinderException {
		Boolean resultado = null;
		
		return resultado;
	}
	
	/**
	 * @param factura
	 * @return
	 * @throws NamingException
	 * @throws RemoteException
	 * @throws CreateException
	 * @throws FinderException
	 *  @ejb.interface-method view-type = "remote"
	 */
	public Boolean eliminarFactura (gcc.fac.jdo.Factura factura) throws NamingException, RemoteException, CreateException,FinderException {
		Boolean resultado = null;
		
		return resultado;
	}
	
	/**
	 * @param factura
	 * @return
	 * @throws NamingException
	 * @throws RemoteException
	 * @throws CreateException
	 * @throws FinderException
	 *  @ejb.interface-method view-type = "remote"
	 */
	public Boolean albaran2Factura (gcc.fac.jdo.Factura factura) throws NamingException, RemoteException, CreateException,FinderException {
		Boolean resultado = null;
		
		return resultado;
	}
	
	/**
	 * @param paciente
	 * @param fechaIni
	 * @param fechaFin
	 * @return
	 * @throws NamingException
	 * @throws RemoteException
	 * @throws CreateException
	 * @throws FinderException
	 *  @ejb.interface-method view-type = "remote"
	 */
	public gcc.fac.jdo.Factura[] getFacturasNoPagadas(Integer PKPaciente, Calendar fechaIni,Calendar fechaFin)throws NamingException, RemoteException, CreateException,FinderException {
		gcc.fac.jdo.Factura[] facturas = null;
	
		return facturas; 
	}
}
ConceptoBean.java (text/plain, 10.7 KB)
package gcc.fac.ejb;

import javax.ejb.EntityContext;

/**
 * This class is part of Middlegen airlines, and it is
 * a CMP EJB accessing the concepto table.
 *
 * @author <a href="http://boss.bekk.no/boss/middlegen/">Middlegen</a>
 *
 *
 * @ejb.bean
 *    type="CMP"
 *    cmp-version="2.x"
 *    name="Concepto"
 *    local-jndi-name="gcc.fac.ConceptoLocalHome"
 *    view-type="both"
 *
 * @ejb.finder
 *    signature="java.util.Collection findAll()"
 *    result-type-mapping="Local"
 *    method-intf="LocalHome"
 *    query="SELECT OBJECT(o) FROM Concepto o"
 *
 * @ejb.finder
 *    signature="java.util.Collection findByConcepto(java.lang.String concepto)"
 *    result-type-mapping="Local"
 *    method-intf="LocalHome"
 *    query="SELECT DISTINCT OBJECT(o) FROM Concepto o WHERE o.concepto = ?1"
 *    description="Concepto is not indexed."
 *
 * @ejb.finder
 *    signature="java.util.Collection findByValor(double valor)"
 *    result-type-mapping="Local"
 *    method-intf="LocalHome"
 *    query="SELECT DISTINCT OBJECT(o) FROM Concepto o WHERE o.valor = ?1"
 *    description="Valor is not indexed."
 *
 * @ejb.finder
 *    signature="java.util.Collection findByImpuestos(double impuestos)"
 *    result-type-mapping="Local"
 *    method-intf="LocalHome"
 *    query="SELECT DISTINCT OBJECT(o) FROM Concepto o WHERE o.impuestos = ?1"
 *    description="impuestos is not indexed."
 *
 * @ejb.finder
 *    signature="java.util.Collection findByPkintervencion(long pkintervencion)"
 *    result-type-mapping="Local"
 *    method-intf="LocalHome"
 *    query="SELECT DISTINCT OBJECT(o) FROM Concepto o WHERE o.pkintervencion = ?1"
 *    description="PKIntervencion is indexed."
 *
 * @ejb.finder
 *    signature="java.util.Collection findByCantidad(int cantidad)"
 *    result-type-mapping="Local"
 *    method-intf="LocalHome"
 *    query="SELECT DISTINCT OBJECT(o) FROM Concepto o WHERE o.cantidad = ?1"
 *    description="Cantidad is not indexed."
 *
 * @ejb.persistence table-name="concepto"
 *
 * @weblogic.data-source-name MySQLClinicaDS
 */
public abstract class ConceptoBean implements javax.ejb.EntityBean {

   /**
    * Returns the concepto
    * @todo support OracleClob,OracleBlob on WLS
    *
    * @return the concepto
    *
    * @ejb.interface-method view-type="both"
    * @ejb.persistence column-name="Concepto"
    */
   public abstract java.lang.String getConcepto();

   /**
    * Sets the concepto
    *
    * @param java.lang.String the new concepto value
    * @ejb.interface-method view-type="both"
    */
   public abstract void setConcepto(java.lang.String concepto);

   /**
    * Returns the valor
    * @todo support OracleClob,OracleBlob on WLS
    *
    * @return the valor
    *
    * @ejb.interface-method view-type="both"
    * @ejb.persistence column-name="Valor"
    */
   public abstract double getValor();

   /**
    * Sets the valor
    *
    * @param double the new valor value
    * @ejb.interface-method view-type="both"
    */
   public abstract void setValor(double valor);

   /**
    * Returns the impuestos
    * @todo support OracleClob,OracleBlob on WLS
    *
    * @return the impuestos
    *
    * @ejb.interface-method view-type="both"
    * @ejb.persistence column-name="impuestos"
    */
   public abstract double getImpuestos();

   /**
    * Sets the impuestos
    *
    * @param double the new impuestos value
    * @ejb.interface-method view-type="both"
    */
   public abstract void setImpuestos(double impuestos);

   /**
    * Returns the pkconcepto
    * @todo support OracleClob,OracleBlob on WLS
    *
    * @return the pkconcepto
    *
    * @ejb.pk-field
    * @ejb.interface-method view-type="both"
    * @ejb.persistence column-name="PKConcepto"
    */
   public abstract java.lang.Long getPkconcepto();

   /**
    * Sets the pkconcepto
    *
    * @param java.lang.Long the new pkconcepto value
    * @ejb.interface-method view-type="both"
    */
   public abstract void setPkconcepto(java.lang.Long pkconcepto);

   /**
    * Returns the pkfactura
    * @todo support OracleClob,OracleBlob on WLS
    *
    * @return the pkfactura
    *
    * @ejb.interface-method view-type="both"
    * @ejb.persistence column-name="PKFactura"
    */
   public abstract java.lang.Long getPkfactura();

   /**
    * Sets the pkfactura
    *
    * @param java.lang.Long the new pkfactura value
    * @ejb.interface-method view-type="both"
    */
   public abstract void setPkfactura(java.lang.Long pkfactura);

   /**
    * Returns the pkintervencion
    * @todo support OracleClob,OracleBlob on WLS
    *
    * @return the pkintervencion
    *
    * @ejb.interface-method view-type="both"
    * @ejb.persistence column-name="PKIntervencion"
    */
   public abstract long getPkintervencion();

   /**
    * Sets the pkintervencion
    *
    * @param long the new pkintervencion value
    * @ejb.interface-method view-type="both"
    */
   public abstract void setPkintervencion(long pkintervencion);

   /**
    * Returns the cantidad
    * @todo support OracleClob,OracleBlob on WLS
    *
    * @return the cantidad
    *
    * @ejb.interface-method view-type="both"
    * @ejb.persistence column-name="Cantidad"
    */
   public abstract int getCantidad();

   /**
    * Sets the cantidad
    *
    * @param int the new cantidad value
    * @ejb.interface-method view-type="both"
    */
   public abstract void setCantidad(int cantidad);

   /**
    * This is a uni-directional one-to-many relationship CMR method
    *
    * @return the related gcc.fac.ejb.FacturaLocal.
    *
    *
    * @ejb.relation
    *    name="factura-cmp20-concepto-cmp20"
    *    role-name="concepto-cmp20-has-factura-cmp20"
    *    target-ejb="Factura"
    *    target-role-name="factura-cmp20-has-concepto-cmp20"
    *    target-multiple="yes"
    *
    * @jboss.relation-mapping style="foreign-key"
    *
    * @weblogic.column-map
    *    foreign-key-column="PKFactura"
    *    key-column="PKFactura"
    *
    * @jboss.relation
    *    fk-constraint="true"
    *    fk-column="PKFactura"
    *    related-pk-field="pkfactura"
    *
    */
   public abstract gcc.fac.ejb.FacturaLocal getFactura();

   /**
    * Sets the related gcc.fac.ejb.FacturaLocal
    *
    * @param gcc.fac.ejb.ConceptoLocal the related $target.variableName
    *
    * @ejb.interface-method view-type="local"
    *
    * @param factura the new CMR value
    */
   public abstract void setFactura(gcc.fac.ejb.FacturaLocal factura);

   /**
    * This create method takes only mandatory (non-nullable) parameters.
    *
    * When the client invokes a create method, the EJB container invokes the ejbCreate method. 
    * Typically, an ejbCreate method in an entity bean performs the following tasks: 
    * <UL>
    * <LI>Inserts the entity state into the database.</LI>
    * <LI>Initializes the instance variables.</LI>
    * <LI>Returns the primary key.</LI>
    * </UL>
    *
    * @param concepto the concepto value
    * @param valor the valor value
    * @param impuestos the impuestos value
    * @param pkconcepto the pkconcepto value
    * @param cantidad the cantidad value
    * @param factura mandatory CMR field
    * @return the primary key of the new instance
    *
    * @ejb.create-method
    */
   public gcc.fac.ejb.ConceptoPK ejbCreate( java.lang.String concepto, double valor, double impuestos, java.lang.Long pkconcepto, int cantidad, gcc.fac.ejb.FacturaLocal factura ) throws javax.ejb.CreateException {
      // Set CMP fields
      setConcepto(concepto);
      setValor(valor);
      setImpuestos(impuestos);
      setPkconcepto(pkconcepto);
      setCantidad(cantidad);
      setPkfactura(factura.getPkfactura());
      // EJB 2.0 spec says return null for CMP ejbCreate methods.
      return null;
   }

   /**
    * The container invokes thos method immediately after it calls ejbCreate. 
    *
    * @param concepto the concepto value
    * @param valor the valor value
    * @param impuestos the impuestos value
    * @param pkconcepto the pkconcepto value
    * @param cantidad the cantidad value
    * @param factura mandatory CMR field
    */
   public void ejbPostCreate( java.lang.String concepto, double valor, double impuestos, java.lang.Long pkconcepto, int cantidad, gcc.fac.ejb.FacturaLocal factura ) throws javax.ejb.CreateException {
      // Set CMR fields
      setFactura(factura);
   }

   /**
    * This create method takes all parameters (both nullable and not nullable). 
    *
    * When the client invokes a create method, the EJB container invokes the ejbCreate method. 
    * Typically, an ejbCreate method in an entity bean performs the following tasks: 
    * <UL>
    * <LI>Inserts the entity state into the database.</LI>
    * <LI>Initializes the instance variables.</LI>
    * <LI>Returns the primary key.</LI>
    * </UL>
    *
    * @param concepto the concepto value
    * @param valor the valor value
    * @param impuestos the impuestos value
    * @param pkconcepto the pkconcepto value
    * @param pkintervencion the pkintervencion value
    * @param cantidad the cantidad value
    * @param factura CMR field
    * @return the primary key of the new instance
    *
    * @ejb.create-method
    */
   public gcc.fac.ejb.ConceptoPK ejbCreate( java.lang.String concepto, double valor, double impuestos,  java.lang.Long pkconcepto, long pkintervencion, int cantidad, gcc.fac.ejb.FacturaLocal factura ) throws javax.ejb.CreateException {
      // Set CMP fields
      setConcepto(concepto);
      setValor(valor);
      setImpuestos(impuestos);
      setPkconcepto(pkconcepto);
      setPkintervencion(pkintervencion);
      setCantidad(cantidad);
    setPkfactura(factura.getPkfactura());
      // EJB 2.0 spec says return null for CMP ejbCreate methods.
      return null;
   }

   /**
    * The container invokes thos method immediately after it calls ejbCreate. 
    *
    * @param concepto the concepto value
    * @param valor the valor value
    * @param impuestos the impuestos value
    * @param pkconcepto the pkconcepto value
    * @param pkintervencion the pkintervencion value
    * @param cantidad the cantidad value
    * @param factura CMR field
    */
   public void ejbPostCreate( java.lang.String concepto, double valor, double impuestos, java.lang.Long pkconcepto, long pkintervencion, int cantidad, gcc.fac.ejb.FacturaLocal factura ) throws javax.ejb.CreateException {
      // Set CMR fields
      setFactura(factura);
   }

   
   public void setEntityContext(EntityContext ctx){
	this.ctx = ctx;
   }
   
   public void unsetEntityContext(){
	this.ctx = null;
   }
   
   public void ejbActivate(){
   }
   
   public void ejbStore(){
   }

   public void ejbRemove(){
   }

   public void ejbPassivate(){
   }

   public void ejbLoad(){
   }
   
   protected EntityContext ctx;     
   // No D:\herramientas\middlegen-2.0-b1\samples/src/middlegen/cmp20-concepto-class-code.txt found.

}
FacturaBean.java (text/plain, 19.2 KB)
package gcc.fac.ejb;

import javax.ejb.EntityContext;

/**
 * This class is part of Middlegen airlines, and it is
 * a CMP EJB accessing the factura table.
 *
 * @author <a href="http://boss.bekk.no/boss/middlegen/">Middlegen</a>
 *
 *
 * @ejb.bean
 *    type="CMP"
 *    cmp-version="2.x"
 *    name="Factura"
 *    local-jndi-name="gcc.fac.FacturaLocalHome"
 *    view-type="both"
 * 
 *
 * @ejb.finder
 *    signature="java.util.Collection findAll()"
 *    result-type-mapping="Local"
 *    method-intf="LocalHome"
 *    query="SELECT OBJECT(o) FROM Factura o"
 *
 * @ejb.finder
 *    signature="java.util.Collection findByNombreCliente(java.lang.String nombreCliente)"
 *    result-type-mapping="Local"
 *    method-intf="LocalHome"
 *    query="SELECT DISTINCT OBJECT(o) FROM Factura o WHERE o.nombreCliente = ?1"
 *    description="NombreCliente is not indexed."
 *
 * @ejb.finder
 *    signature="java.util.Collection findByDirCliente(java.lang.String dirCliente)"
 *    result-type-mapping="Local"
 *    method-intf="LocalHome"
 *    query="SELECT DISTINCT OBJECT(o) FROM Factura o WHERE o.dirCliente = ?1"
 *    description="DirCliente is not indexed."
 *
 * @ejb.finder
 *    signature="java.util.Collection findByPagada(byte pagada)"
 *    result-type-mapping="Local"
 *    method-intf="LocalHome"
 *    query="SELECT DISTINCT OBJECT(o) FROM Factura o WHERE o.pagada = ?1"
 *    description="Pagada is not indexed."
 *
 * @ejb.finder
 *    signature="java.util.Collection findByTipoPago(java.lang.String tipoPago)"
 *    result-type-mapping="Local"
 *    method-intf="LocalHome"
 *    query="SELECT DISTINCT OBJECT(o) FROM Factura o WHERE o.tipoPago = ?1"
 *    description="TipoPago is not indexed."
 *
 * @ejb.finder
 *    signature="java.util.Collection findByCodigoFactura(java.lang.String codigoFactura)"
 *    result-type-mapping="Local"
 *    method-intf="LocalHome"
 *    query="SELECT DISTINCT OBJECT(o) FROM Factura o WHERE o.codigoFactura = ?1"
 *    description="CodigoFactura is not indexed."
 *
 * @ejb.finder
 *    signature="java.util.Collection findByPkpaciente(long pkpaciente)"
 *    result-type-mapping="Local"
 *    method-intf="LocalHome"
 *    query="SELECT DISTINCT OBJECT(o) FROM Factura o WHERE o.pkpaciente = ?1"
 *    description="PKPaciente is indexed."
 *
 * @ejb.finder
 *    signature="java.util.Collection findByFecha(java.sql.Date fecha)"
 *    result-type-mapping="Local"
 *    method-intf="LocalHome"
 *    query="SELECT DISTINCT OBJECT(o) FROM Factura o WHERE o.fecha = ?1"
 *    description="Fecha is not indexed."
 *
 * @ejb.finder
 *    signature="java.util.Collection findByDnicliente(java.lang.String dnicliente)"
 *    result-type-mapping="Local"
 *    method-intf="LocalHome"
 *    query="SELECT DISTINCT OBJECT(o) FROM Factura o WHERE o.dnicliente = ?1"
 *    description="DNICliente is not indexed."
 *
 * @ejb.finder
 *    signature="java.util.Collection findByCpcliente(int cpcliente)"
 *    result-type-mapping="Local"
 *    method-intf="LocalHome"
 *    query="SELECT DISTINCT OBJECT(o) FROM Factura o WHERE o.cpcliente = ?1"
 *    description="CPCliente is not indexed."
 *
 * @ejb.finder
 *    signature="java.util.Collection findByCiudadCliente(java.lang.String ciudadCliente)"
 *    result-type-mapping="Local"
 *    method-intf="LocalHome"
 *    query="SELECT DISTINCT OBJECT(o) FROM Factura o WHERE o.ciudadCliente = ?1"
 *    description="CiudadCliente is not indexed."
 *
 * @ejb.finder
 *    signature="java.util.Collection findByProvinciaCliente(java.lang.String provinciaCliente)"
 *    result-type-mapping="Local"
 *    method-intf="LocalHome"
 *    query="SELECT DISTINCT OBJECT(o) FROM Factura o WHERE o.provinciaCliente = ?1"
 *    description="ProvinciaCliente is not indexed."
 *
 * @ejb.finder
 *    signature="java.util.Collection findByPaisCliente(java.lang.String paisCliente)"
 *    result-type-mapping="Local"
 *    method-intf="LocalHome"
 *    query="SELECT DISTINCT OBJECT(o) FROM Factura o WHERE o.paisCliente = ?1"
 *    description="PaisCliente is not indexed."
 *
 * @ejb.finder
 *    signature="java.util.Collection findByAlbaran(byte albaran)"
 *    result-type-mapping="Local"
 *    method-intf="LocalHome"
 *    query="SELECT DISTINCT OBJECT(o) FROM Factura o WHERE o.albaran = ?1"
 *    description="Albaran is not indexed."
 *
 * @ejb.finder
 *    signature="java.util.Collection findByPkcita(long pkcita)"
 *    result-type-mapping="Local"
 *    method-intf="LocalHome"
 *    query="SELECT DISTINCT OBJECT(o) FROM Factura o WHERE o.pkcita = ?1"
 *    description="PKCita is not indexed."
 *
 * @ejb.persistence table-name="factura"
 *
 * @weblogic.data-source-name MySQLClinicaDS
 */
public abstract class FacturaBean implements javax.ejb.EntityBean {

   /**
    * Returns the nombreCliente
    * @todo support OracleClob,OracleBlob on WLS
    *
    * @return the nombreCliente
    *
    * @ejb.interface-method view-type="both"
    * @ejb.persistence column-name="NombreCliente"
    */
   public abstract java.lang.String getNombreCliente();

   /**
    * Sets the nombreCliente
    *
    * @param java.lang.String the new nombreCliente value
    * @ejb.interface-method view-type="both"
    */
   public abstract void setNombreCliente(java.lang.String nombreCliente);

   /**
    * Returns the dirCliente
    * @todo support OracleClob,OracleBlob on WLS
    *
    * @return the dirCliente
    *
    * @ejb.interface-method view-type="both"
    * @ejb.persistence column-name="DirCliente"
    */
   public abstract java.lang.String getDirCliente();

   /**
    * Sets the dirCliente
    *
    * @param java.lang.String the new dirCliente value
    * @ejb.interface-method view-type="both"
    */
   public abstract void setDirCliente(java.lang.String dirCliente);

   /**
    * Returns the observaciones
    * @todo support OracleClob,OracleBlob on WLS
    *
    * @return the observaciones
    *
    * @ejb.interface-method view-type="both"
    * @ejb.persistence column-name="Observaciones"
    */
   public abstract java.lang.Object getObservaciones();

   /**
    * Sets the observaciones
    *
    * @param java.lang.Object the new observaciones value
    * @ejb.interface-method view-type="both"
    */
   public abstract void setObservaciones(java.lang.Object observaciones);

   /**
    * Returns the pagada
    * @todo support OracleClob,OracleBlob on WLS
    *
    * @return the pagada
    *
    * @ejb.interface-method view-type="both"
    * @ejb.persistence column-name="Pagada"
    */
   public abstract byte getPagada();

   /**
    * Sets the pagada
    *
    * @param byte the new pagada value
    * @ejb.interface-method view-type="both"
    */
   public abstract void setPagada(byte pagada);

   /**
    * Returns the tipoPago
    * @todo support OracleClob,OracleBlob on WLS
    *
    * @return the tipoPago
    *
    * @ejb.interface-method view-type="both"
    * @ejb.persistence column-name="TipoPago"
    */
   public abstract java.lang.String getTipoPago();

   /**
    * Sets the tipoPago
    *
    * @param java.lang.String the new tipoPago value
    * @ejb.interface-method view-type="both"
    */
   public abstract void setTipoPago(java.lang.String tipoPago);

   /**
    * Returns the pkfactura
    * @todo support OracleClob,OracleBlob on WLS
    *
    * @return the pkfactura
    *
    * @ejb.pk-field
    * @ejb.interface-method view-type="both"
    * @ejb.persistence column-name="PKFactura"
    */
   public abstract java.lang.Long getPkfactura();

   /**
    * Sets the pkfactura
    *
    * @param java.lang.Long the new pkfactura value
    * @ejb.interface-method view-type="both"
    */
   public abstract void setPkfactura(java.lang.Long pkfactura);

   /**
    * Returns the codigoFactura
    * @todo support OracleClob,OracleBlob on WLS
    *
    * @return the codigoFactura
    *
    * @ejb.interface-method view-type="both"
    * @ejb.persistence column-name="CodigoFactura"
    */
   public abstract java.lang.String getCodigoFactura();

   /**
    * Sets the codigoFactura
    *
    * @param java.lang.String the new codigoFactura value
    * @ejb.interface-method view-type="both"
    */
   public abstract void setCodigoFactura(java.lang.String codigoFactura);

   /**
    * Returns the pkpaciente
    * @todo support OracleClob,OracleBlob on WLS
    *
    * @return the pkpaciente
    *
    * @ejb.interface-method view-type="both"
    * @ejb.persistence column-name="PKPaciente"
    */
   public abstract long getPkpaciente();

   /**
    * Sets the pkpaciente
    *
    * @param long the new pkpaciente value
    * @ejb.interface-method view-type="both"
    */
   public abstract void setPkpaciente(long pkpaciente);

   /**
    * Returns the fecha
    * @todo support OracleClob,OracleBlob on WLS
    *
    * @return the fecha
    *
    * @ejb.interface-method view-type="both"
    * @ejb.persistence column-name="Fecha"
    */
   public abstract java.sql.Date getFecha();

   /**
    * Sets the fecha
    *
    * @param java.sql.Date the new fecha value
    * @ejb.interface-method view-type="both"
    */
   public abstract void setFecha(java.sql.Date fecha);

   /**
    * Returns the dnicliente
    * @todo support OracleClob,OracleBlob on WLS
    *
    * @return the dnicliente
    *
    * @ejb.interface-method view-type="both"
    * @ejb.persistence column-name="DNICliente"
    */
   public abstract java.lang.String getDnicliente();

   /**
    * Sets the dnicliente
    *
    * @param java.lang.String the new dnicliente value
    * @ejb.interface-method view-type="both"
    */
   public abstract void setDnicliente(java.lang.String dnicliente);

   /**
    * Returns the cpcliente
    * @todo support OracleClob,OracleBlob on WLS
    *
    * @return the cpcliente
    *
    * @ejb.interface-method view-type="both"
    * @ejb.persistence column-name="CPCliente"
    */
   public abstract int getCpcliente();

   /**
    * Sets the cpcliente
    *
    * @param int the new cpcliente value
    * @ejb.interface-method view-type="both"
    */
   public abstract void setCpcliente(int cpcliente);

   /**
    * Returns the ciudadCliente
    * @todo support OracleClob,OracleBlob on WLS
    *
    * @return the ciudadCliente
    *
    * @ejb.interface-method view-type="both"
    * @ejb.persistence column-name="CiudadCliente"
    */
   public abstract java.lang.String getCiudadCliente();

   /**
    * Sets the ciudadCliente
    *
    * @param java.lang.String the new ciudadCliente value
    * @ejb.interface-method view-type="both"
    */
   public abstract void setCiudadCliente(java.lang.String ciudadCliente);

   /**
    * Returns the provinciaCliente
    * @todo support OracleClob,OracleBlob on WLS
    *
    * @return the provinciaCliente
    *
    * @ejb.interface-method view-type="both"
    * @ejb.persistence column-name="ProvinciaCliente"
    */
   public abstract java.lang.String getProvinciaCliente();

   /**
    * Sets the provinciaCliente
    *
    * @param java.lang.String the new provinciaCliente value
    * @ejb.interface-method view-type="both"
    */
   public abstract void setProvinciaCliente(java.lang.String provinciaCliente);

   /**
    * Returns the paisCliente
    * @todo support OracleClob,OracleBlob on WLS
    *
    * @return the paisCliente
    *
    * @ejb.interface-method view-type="both"
    * @ejb.persistence column-name="PaisCliente"
    */
   public abstract java.lang.String getPaisCliente();

   /**
    * Sets the paisCliente
    *
    * @param java.lang.String the new paisCliente value
    * @ejb.interface-method view-type="both"
    */
   public abstract void setPaisCliente(java.lang.String paisCliente);

   /**
    * Returns the albaran
    * @todo support OracleClob,OracleBlob on WLS
    *
    * @return the albaran
    *
    * @ejb.interface-method view-type="both"
    * @ejb.persistence column-name="Albaran"
    */
   public abstract byte getAlbaran();

   /**
    * Sets the albaran
    *
    * @param byte the new albaran value
    * @ejb.interface-method view-type="both"
    */
   public abstract void setAlbaran(byte albaran);

   /**
    * Returns the pkcita
    * @todo support OracleClob,OracleBlob on WLS
    *
    * @return the pkcita
    *
    * @ejb.interface-method view-type="both"
    * @ejb.persistence column-name="PKCita"
    */
   public abstract long getPkcita();

   /**
    * Sets the pkcita
    *
    * @param long the new pkcita value
    * @ejb.interface-method view-type="both"
    */
   public abstract void setPkcita(long pkcita);

   /**
    * This is a uni-directional one-to-many relationship CMR method
    *
    * @return a java.util.Collection of related gcc.fac.ejb.ConceptoLocal.
    * middlegen.plugins.entitybean.Entity20Table@c272bc
    * class middlegen.plugins.entitybean.Entity20Table
    * middlegen.plugins.entitybean.Entity20Table
    * @ejb.interface-method view-type="local"
    *
    * @ejb.relation
    *    name="factura-cmp20-concepto-cmp20"
    *    role-name="factura-cmp20-has-concepto-cmp20"
    *    target-ejb="Concepto"
    *    target-role-name="concepto-cmp20-has-factura-cmp20"
    *    target-multiple="no"
    *
    * @jboss.relation-mapping style="foreign-key"
    *
    * @weblogic.target-column-map
    *    foreign-key-column="PKFactura"
    *    key-column="PKFactura"
    *
    * @jboss.target-relation
    *    fk-constraint="true"
    *    fk-column="PKFactura"
    *    related-pk-field="pkfactura"
    *
    */
   public abstract java.util.Collection getConceptos();

   /**
    * Sets a collection of related gcc.fac.ejb.ConceptoLocal
    *
    * @param a collection of related gcc.fac.ejb.ConceptoLocal
    *
    * @ejb.interface-method view-type="local"
    *
    * @param conceptos the new CMR value
    */
   public abstract void setConceptos(java.util.Collection conceptos);

   /**
    * This create method takes only mandatory (non-nullable) parameters.
    *
    * When the client invokes a create method, the EJB container invokes the ejbCreate method. 
    * Typically, an ejbCreate method in an entity bean performs the following tasks: 
    * <UL>
    * <LI>Inserts the entity state into the database.</LI>
    * <LI>Initializes the instance variables.</LI>
    * <LI>Returns the primary key.</LI>
    * </UL>
    *
    * @param observaciones the observaciones value
    * @param pagada the pagada value
    * @param tipoPago the tipoPago value
    * @param pkfactura the pkfactura value
    * @param fecha the fecha value
    * @return the primary key of the new instance
    *
    * @ejb.create-method
    */
   public gcc.fac.ejb.FacturaPK ejbCreate( java.lang.Object observaciones, byte pagada, java.lang.String tipoPago, java.lang.Long pkfactura, java.sql.Date fecha ) throws javax.ejb.CreateException {
      // Set CMP fields
      setObservaciones(observaciones);
      setPagada(pagada);
      setTipoPago(tipoPago);
      setPkfactura(pkfactura);
      setFecha(fecha);
      // EJB 2.0 spec says return null for CMP ejbCreate methods.
      return null;
   }

   /**
    * The container invokes thos method immediately after it calls ejbCreate. 
    *
    * @param observaciones the observaciones value
    * @param pagada the pagada value
    * @param tipoPago the tipoPago value
    * @param pkfactura the pkfactura value
    * @param fecha the fecha value
    */
   public void ejbPostCreate( java.lang.Object observaciones, byte pagada, java.lang.String tipoPago, java.lang.Long pkfactura, java.sql.Date fecha ) throws javax.ejb.CreateException {
      // Set CMR fields
   }

   /**
    * This create method takes all parameters (both nullable and not nullable). 
    *
    * When the client invokes a create method, the EJB container invokes the ejbCreate method. 
    * Typically, an ejbCreate method in an entity bean performs the following tasks: 
    * <UL>
    * <LI>Inserts the entity state into the database.</LI>
    * <LI>Initializes the instance variables.</LI>
    * <LI>Returns the primary key.</LI>
    * </UL>
    *
    * @param nombreCliente the nombreCliente value
    * @param dirCliente the dirCliente value
    * @param observaciones the observaciones value
    * @param pagada the pagada value
    * @param tipoPago the tipoPago value
    * @param pkfactura the pkfactura value
    * @param codigoFactura the codigoFactura value
    * @param pkpaciente the pkpaciente value
    * @param fecha the fecha value
    * @param dnicliente the dnicliente value
    * @param cpcliente the cpcliente value
    * @param ciudadCliente the ciudadCliente value
    * @param provinciaCliente the provinciaCliente value
    * @param paisCliente the paisCliente value
    * @param albaran the albaran value
    * @param pkcita the pkcita value
    * @return the primary key of the new instance
    *
    * @ejb.create-method
    */
   public gcc.fac.ejb.FacturaPK ejbCreate( java.lang.String nombreCliente, java.lang.String dirCliente, java.lang.Object observaciones, byte pagada, java.lang.String tipoPago, java.lang.Long pkfactura, java.lang.String codigoFactura, long pkpaciente, java.sql.Date fecha, java.lang.String dnicliente, int cpcliente, java.lang.String ciudadCliente, java.lang.String provinciaCliente, java.lang.String paisCliente, byte albaran, long pkcita ) throws javax.ejb.CreateException {
      // Set CMP fields
      setNombreCliente(nombreCliente);
      setDirCliente(dirCliente);
      setObservaciones(observaciones);
      setPagada(pagada);
      setTipoPago(tipoPago);
      setPkfactura(pkfactura);
      setCodigoFactura(codigoFactura);
      setPkpaciente(pkpaciente);
      setFecha(fecha);
      setDnicliente(dnicliente);
      setCpcliente(cpcliente);
      setCiudadCliente(ciudadCliente);
      setProvinciaCliente(provinciaCliente);
      setPaisCliente(paisCliente);
      setAlbaran(albaran);
      setPkcita(pkcita);
      // EJB 2.0 spec says return null for CMP ejbCreate methods.
      return null;
   }

   /**
    * The container invokes thos method immediately after it calls ejbCreate. 
    *
    * @param nombreCliente the nombreCliente value
    * @param dirCliente the dirCliente value
    * @param observaciones the observaciones value
    * @param pagada the pagada value
    * @param tipoPago the tipoPago value
    * @param pkfactura the pkfactura value
    * @param codigoFactura the codigoFactura value
    * @param pkpaciente the pkpaciente value
    * @param fecha the fecha value
    * @param dnicliente the dnicliente value
    * @param cpcliente the cpcliente value
    * @param ciudadCliente the ciudadCliente value
    * @param provinciaCliente the provinciaCliente value
    * @param paisCliente the paisCliente value
    * @param albaran the albaran value
    * @param pkcita the pkcita value
    */
   public void ejbPostCreate( java.lang.String nombreCliente, java.lang.String dirCliente, java.lang.Object observaciones, byte pagada, java.lang.String tipoPago, java.lang.Long pkfactura, java.lang.String codigoFactura, long pkpaciente, java.sql.Date fecha, java.lang.String dnicliente, int cpcliente, java.lang.String ciudadCliente, java.lang.String provinciaCliente, java.lang.String paisCliente, byte albaran, long pkcita ) throws javax.ejb.CreateException {
      // Set CMR fields
   }

   
   public void setEntityContext(EntityContext ctx){
	this.ctx = ctx;
   }
   
   public void unsetEntityContext(){
	this.ctx = null;
   }
   
   public void ejbActivate(){
   }
   
   public void ejbStore(){
   }

   public void ejbRemove(){
   }

   public void ejbPassivate(){
   }

   public void ejbLoad(){
   }
   
   protected EntityContext ctx;
     
   // No D:\herramientas\middlegen-2.0-b1\samples/src/middlegen/cmp20-factura-class-code.txt found.

}
xdoclet-build.xml (text/xml, 2.4 KB)
<?xml version="1.0" encoding="UTF-8"?>
<project default="_generation_" name="XDoclet Generator">
<path id="xdoclet.classpath"><pathelement location="D:/proyectos/GestionClinica/classes"/>
<pathelement location="D:/proyectos/GestionClinica/lib/bsh-1.2b6.jar"/>
<pathelement location="D:/proyectos/GestionClinica/lib/gnujaxp.jar"/>
<pathelement location="D:/proyectos/GestionClinica/lib/itext-1.00.jar"/>
<pathelement location="D:/proyectos/GestionClinica/lib/junit_3.8.1.jar"/>
<pathelement location="D:/proyectos/GestionClinica/lib/mm.jar"/>
<pathelement location="D:/proyectos/GestionClinica/lib/pixie-0.8.0.jar"/>
<pathelement location="D:/proyectos/GestionClinica/lib/poi-2.0-pre3-20030728.jar"/>
<pathelement location="D:/proyectos/GestionClinica/lib/skinlf.jar"/>
<pathelement location="D:/proyectos/GestionClinica/lib/javax.servlet.jar"/>
<pathelement location="D:/proyectos/GestionClinica/lib/jboss-j2ee.jar"/>
<pathelement location="D:/proyectos/GestionClinica/lib/jbossall-client.jar"/>
<pathelement location="D:/proyectos/GestionClinica/lib/jfreereport-0.8.2.jar"/>
<pathelement location="D:/proyectos/GestionClinica/lib/jakarta-poi-1.5.1-final-20020615.jar"/>
<pathelement location="D:/proyectos/GestionClinica/lib/jcommon-0.7.2.jar"/>

<fileset dir="D:/herramientas/eclipse/plugins/org.jboss.ide.eclipse.xdoclet.core_1.2.2/">
<include name="*.jar"/>
</fileset>
</path>
<target name="_generation_" depends="N10004"/>
<target name="N10004" description="EJB">
<taskdef classpathref="xdoclet.classpath" classname="xdoclet.modules.ejb.EjbDocletTask" name="ejbdoclet"/><ejbdoclet ejbSpec="2.0"  excludedTags="@version,@author,@todo"  destDir="src"  verbose="true" >










<fileset dir="src"  includes="**/ejb/*Bean.java,**/wrp/*Bean.java" >



</fileset>

<remoteinterface>
























</remoteinterface>
<localinterface>
























</localinterface>
<homeinterface>
























</homeinterface>
<localhomeinterface>
























</localhomeinterface>

<entitypk>
























</entitypk>


<session>
























</session>
<utilobject includeGUID="true"  cacheHomes="true" >



























</utilobject>
<deploymentdescriptor validateXML="true"  destDir="src/META-INF" >
































</deploymentdescriptor>
<jboss Version="3.2"  destDir="src/META-INF" >









































</jboss>
</ejbdoclet></target>
</project>
smime.p7s (application/x-pkcs7-signature, 3.2 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.