On vie, 2003-08-01 at 11:22, Cristian Rossel Moraga wrote:
> Hi David!
>
> Help me, please...
>
> How can you with xdoclet declare in a ENTITY BEAN CMP (WORKER) in a PK
I'm sorry...
How can you with xdoclet declare in a ENTITY BEAN CMP (HAVE_INCOME) in a
PK
> (primary key) composed by three attribute, and two of these are FK
> (foreing key)?
>
> We use postgreSql 7.3.3, JBOSS 3.07, XDOCLET, ECLIPSE + LOMBOZ.
>
> Next we introduce other diagram for explicating our problem:
>
> +-------------+ +-----------------------------------+
> |INCOME |1 *|HAVE_INCOME |
> +-------------+------+-----------------------------------|
> |codeIncome PK| |date PK |
> |name | |codeIncome PK,FK(references INCOME)|
> +-------------+ |codeWorker PK,FK(references WORKER)|
> |valor |
> +-----------------------------------+
> *|
> |
> |
> 1|
> +-------------+
> |WORKER |
> +-------------|
> |codeWorker PK|
> |nameWorker |
> +-------------+
>
> INCOME = INGRESOS.
> HAVE_INCOME = TIENE_INGRESOS.
> WORKER = TRABAJADOR.
> code = codigo.
>
>
> +----------------------+
> |Income |
> +----------------------+
> |PK | |
> |codeIncome|nameIncome |
> +----------+-----------|
> |01 |salary |
> |02 |bonus |
> |03 |extra_hours|
> +----------------------+
>
> +------------------------+
> |Worker |
> +------------------------+
> |PK | |
> |codeWorker|nameWorker |
> +----------+-------------|
> |W1 |John Doe |
> |W2 |William Smith|
> +------------------------+
>
> +--------------------------------------+
> |HAVE_INCOME |
> +--------------------------------------+
> |PK |PK, FK |PK, FK | |
> |date |codeIncome|codeWorker|valor|
> +----------+----------+----------+-----|
> |03/01/2003|01 |W1 |1000 |
> |05/01/2003|02 |W1 |0500 |
> |08/01/2003|02 |W1 |0300 |
> |08/01/2003|03 |W1 |0500 |
> |04/01/2003|01 |W2 |1000 |
> |05/01/2003|02 |W2 |1500 |
> |05/01/2003|03 |W2 |0200 |
> +--------------------------------------+
>
>
> > We have developed the following code, but at the moment for making deploy in
> > Jboss, this throw one exception: (Nostros hemos desarrollado el siguiente c�digo,
> > pero en el momento de realizar el montaje en jboss, este lanza la siguiente
> > Exception)
> >
> > "attribute "icodigoestudiante" duplicated
> >
> > The code of the InscriptionEJB is:
> >
> >
> > package leufu;
> >
> > import javax.ejb.EntityBean;
> >
> > /**
> > * @ejb.bean name="Inscripcion"
> > * local-jndi-name="InscripcionBean"
> > * type="CMP"
> > * cmp-version="2.x"
> > * view-type="local"
> > * schema="Inscripcion"
> > *
> > * @ejb.persistence
> > * table-name="inscripcion"
> > *
> > * @ejb.finder
> > * query="SELECT OBJECT(a) FROM Inscripcion as a"
> > * signature="java.util.Collection findAll()"
> > *
> > * @jboss.create-table true
> > *
> > **/
> >
> > public abstract class InscripcionBean implements EntityBean {
> >
> > /**
> > *
> > * @ejb.create-method
> > */
> > public InscripcionPK ejbCreate(String codigo, EstudianteLocal e, CursoLocal c)
> > throws javax.ejb.CreateException {
> > setIMatricula(codigo);
> > return new InscripcionPK(codigo,e,c);
> > }
> >
> > /**
> > * The container invokes this method immediately after it calls ejbCreate.
> > *
> > */
> > public void ejbPostCreate(String codigo, EstudianteLocal e, CursoLocal c) throws
> > javax.ejb.CreateException {
> > setICodigoEstudiante(e);
> > setICodigoCurso(c);
> > }
> >
> > /**
> > *
> > * @ejb.persistent-field
> > * @ejb.pk-field
> > * @ejb.persistence
> > * @jboss.column-name imatricula
> > * @ejb.interface-method
> > */
> > public abstract java.lang.String getIMatricula();
> >
> > /**
> > * @ejb.interface-method
> > */
> > public abstract void setIMatricula(java.lang.String IMatricula);
> >
> > /**
> > *
> > *
> > [EMAIL PROTECTED]
> > [EMAIL PROTECTED]
> > [EMAIL PROTECTED] nce
> > [EMAIL PROTECTED] icodigoestudiante
> > [EMAIL PROTECTED]
> > *
> >
> > /* para las relaciones
> > *
> > [EMAIL PROTECTED] name="estudiante-inscripcion"
> > *role-name="inscripcion-estudiante"
> > *target-ejb="Estudiante"
> > *target-role-name=" "
> > *target-multiple="yes"
> > *
> > [EMAIL PROTECTED] related-pk-field="eCodigo"
> > *fk-column="icodigoestudiante"
> > *fk-constraint="true"
> > **/
> >
> > public abstract leufu.EstudianteLocal getICodigoEstudiante();
> >
> > /**
> > *
> > * @ejb.interface-method
> > */
> > public abstract void setICodigoEstudiante(leufu.EstudianteLocal ICodigoEstudiante);
> >
> > /**
> > *
> > * @ejb.persistent-field
> > * @ejb.pk-field
> > * @ejb.persistence
> > * @jboss.colum-name icodigocurso
> > * @ejb.interface-method
> >
> > * para las relaciones
> > * @ejb.relation name="curso-inscripcion"
> > * role-name="inscripcion-curso"
> > * target-ejb="Curso"
> > * target-role-name=" "
> > * target-multiple="yes"
> > *
> > [EMAIL PROTECTED] related-pk-field="cCodigo" *fk-column="icodigocurso"
> > *fk-constraint="true"
> > *
> > *
> > *
> > */
> > public abstract leufu.CursoLocal getICodigoCurso();
> >
> > /**
> > *
> > * @ejb.interface-method
> > */
> > public abstract void setICodigoCurso(leufu.CursoLocal ICodigoCurso);
> >
> > }
> >
> Thanks...
>
>
> Cristian Rossel Moraga
> CEO Leufu Ingenieria y Negocios Ltda.
> Lebu, Chile, 56-41-511655.
>
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user