[JBoss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Re: M:N CMP Relationship with unknown Primay Key fails with
I could not resolve the problem, finally removed the unknown-pk and did it by hand with a select max(id) and increment. Tried before almost all possible combinations of XDoclet attibutes. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3953122#3953122 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3953122 Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence, JBoss/CMP, Hibernate, Database] - M:N CMP Relationship with unknown Primay Key fails with comp
I want to create an m:n relationship between a User and Appointment. XDoclet in User looks like this: /** @ejb.bean name="User" * description="An user with a container generated pk" * display-name="User" * jndi-name="ejb/User" * local-jndi-name = "ejb/UserLocalHome" * type="CMP" * transaction-type="Container" * cmp-version="2.x" * view-type="local" * @jboss.unknown-pk * class="java.lang.Integer" * column-name="pk" * field-name="id" * sql-type="INTEGER" * jdbc-type="INTEGER" * auto-increment="true" * @jboss.entity-command * name="hsqldb-fetch-key" * class="org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCHsqldbCreateCommand" * @ejb.pk * class="java.lang.Integer" * generate="false" and the get-ter for the field: /** * @return Collection of appointments. * @ejb.interface-method view-type="local" * @ejb.relation * name="UserAppointment" * role-name = "user-has-appointments" * target-ejb = "Appointment" * target-role-name = "appointment-has-users" * target-multiple = "yes" * @jboss.relation * related-pk-field = "id" * fk-column = "fk" */ public abstract java.util.Collection getAppointments(); XDoclet in Apointment looks like this (basically the same as in User): /** @ejb.bean name="Appointment" * description="An appointment with a container generated pk" * display-name="Appointment" * jndi-name="ejb/Appointment" * type="CMP" * transaction-type="Container" * cmp-version="2.x" * view-type="local" * @jboss.unknown-pk * class="java.lang.Integer" * column-name="pk" * field-name="id" * sql-type="INTEGER" * jdbc-type="INTEGER" * auto-increment="true" * @jboss.entity-command * name="hsqldb-fetch-key" * class="org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCHsqldbCreateCommand" * @ejb.pk * class="java.lang.Integer" * generate="false" and the get-ter for the field (also basically the same as in User): /** * @return Collection of users. * @ejb.interface-method view-type="local" * @ejb.relation * name = "UserAppointment" * role-name = "appointment-has-users" * target-ejb = "User" * target-role-name = "user-has-appointments" * target-multiple = "yes" * @jboss.relation * related-pk-field = "id" * fk-column = "fk" */ public abstract java.util.Collection getUsers(); The relationship in the created jbosscmp-jdbc.xml looks ok to me: UserAppointment user-has-appointments id pk appointment-has-users id pk But still when I try to deplay with JBoss 4.0.4 I get following error: org.jboss.deployment.DeploymentException: Both roles of a relation-table mapped relationship must have key fields: ejb-relation-name=UserAppointment Has anyone a hint? Cheers, Jons. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3950732#3950732 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3950732 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user