Unless it is many-to-many relationship you should use either @jboss.relation or @jboss.target-relation tags.

Pedro Salazar wrote:

Greetings,


-I have 2 entities mapped from 2 database tables, ACCESS_PERMISSION and ACCESS_SCHEDULE. -the "relation" between them is, ACCESS_PERMISSION *has* several ACCESS_SCHEDULE, and a 1-N -*they don't share a common key*

ACCESS_PERMISSION
-----------------
SID_ID
SERVICE_ID
A1
A2
...
CONSTRAINS: UNIQUE (SID_ID,SERVICE_ID)

ACCESS_SCHEDULE
---------------
SID_ID
SERVICE_ID
TIME_ACCESS_START
B1
B2

CONSTRAINTS: UNIQUE(SID_ID,SERVICE_ID,TIME_ACCESS_START)

Can I define a relationship between them? I tried to use a relation just with 2 attributes of table
ACCESS_SCHEDULE and not using the 3rd one (TIME_ACCESS_START) but JBOSS
shows me that error:


"
[ObjectName: jboss.j2ee:jndiName=ejb/AccessScheduleLocal,service=EJB
state: FAILED
I Depend On: Depends On Me: org.jboss.deployment.DeploymentException: Mappings were
not provided for all fields: unmaped fields=[timeAccessStart] in
role=schedules_BELONG_TO_access_permission, ObjectName:
jboss.j2ee:jndiName=ejb/AccessPermissionLocal,service=EJB
state: FAILED
I Depend On: Depends On Me: org.jboss.deployment.DeploymentException: Mappings were
not provided for all fields: unmaped fields=[timeAccessStart] in
role=schedules_BELONG_TO_access_permission]
"


Can I do this in another way? What is normal to do, a "findByXX()"
method in ACCESS_SCHEDULE and a interface method on ACCESS_PERMISSION?
But in that case, there must exist some programatic code and I don't
know how can I synchronize access to that methods?

To complete, I put in below also the xdoclet code of my relationship:

"
/** * @ejb.relation
* name="access_permission_TO__access_schedule"
* role-name="access_permission_HAS_schedules"
* cascade-delete="no"
* target-ejb="AccessSchedule"
* target-role-name="schedules_BELONG_TO_access_permission"
* target-cascade-delete="yes"
* @ejb.interface-method
* view-type="local"
* @ejb.transaction
* type="Supports"
* @jboss.relation
* related-pk-field="sidId"
* fk-column="sidId"
* @jboss.relation
* related-pk-field="primitiveId"
* fk-column="primitiveId"
* @jboss.target-relation
* related-pk-field="sidId"
* fk-column="sidId"
* @jboss.target-relation
* related-pk-field="primitiveId"
* fk-column="primitiveId"
* @jboss.relation-mapping
* style="relation-table"
* @jboss.relation-table
* table-name="uif_access_permission"
*/
public abstract java.util.Collection getSchedules();
"


regards,
Pedro Salazar




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to