Hola Cristian, >From what I can gather from your naming convention, icodigo is the *entire* PK of >inscripcion. In other words, you generate a unique value for icodigo just as you do >for ecodigo in estudiante. If that's the case, then (ecodigo, ccodigo) make up an >alternate key for inscripcion, but they are not part of the PK.
Can you please verify that this is the case or further explain and we can go from there? [[ De lo que puedo recolectar de su convenci�n de nombramiento, el icodigo es el PK *entero* de inscripcion. Es decir usted genera un valor �nico para icodigo apenas como usted hace para ecodigo en estudiante. Si �se es el caso, entonces (ecodigo, ccodigo) es una AK (alternate key) para inscripcion, pero los no son parte del PK. �Puede usted verificar por favor que sea esto el caso o explicar m�s lejos y podemos ir de all�? ]] David Harkness Sony Pictures Digital Networks (310) 482-4756 -----Original Message----- From: Cristian Rossel Moraga [mailto:[EMAIL PROTECTED] Sent: Thursday, July 31, 2003 6:14 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; Jorge Galindo Fulgeri; Julio Eyzaguirre Subject: [Xdoclet-user] Primary Key composed by Foreing Key Hello guy! We used postgreSqk, JBOSS 3.07, XDOCLET, ECLIPSE + LOMBOZ. Next we introduce this diagram for explicating our problem (A continuacion presentamos el siguiente diagrama para explicar nuestro problema) +----------+ +------------------------------------+ |ESTUDIANTE|1 *|INSCRIPCION | +----------+-------+------------------------------------| |ecodigo PK| |icodigo PK | |enombre | |ecodigo PK,FK(references ESTUDIANTE)| +----------+ |ccodigo PK,FK(references CURSO) | +------------------------------------+ *| | | | | 1| +----------+ |CURSO | +----------| |ccodigo PK| |cnombre | +----------+ ESTUDIANTE = STUDENT. INSCRIPCION = INSCRIPTION. CURSO = COURSE. codigo = code. How can you defining in a ENTITY BEAN CMP (INSCRIPCION) in a PK (primary key) composed by three atribute, and two of these are FK (foreing key)?) (�Como definir en un ENTITY BEAN CMP (INSCRIPCION) una PK (primary key) compuesta por 3 atributos, de los cuales 2 son FK (foreing key)?) 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. 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 ------------------------------------------------------- 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
