-
1. Re: jboss get() for foreign key on 1-m CMR fails
dsundstrom Aug 7, 2002 2:00 PM (in response to cyates)This means that the mapping is not setup correctly in the ejb-jar.xml file, because JBossCMP does not know about the abstract accessor. Did you declare a cmp field accessor for 'username' (case counts) in the ejb-jar.xml file.
-
2. Re: jboss get() for foreign key on 1-m CMR fails
cyates Aug 8, 2002 9:03 AM (in response to cyates)I used the following xdoclet definition on the "One" side:
/**
* @return all the criteria for this report
*
* @ejb:interface-method view-type="local"
* @ejb:relation
* name="report-criteria"
* role-name="one-report-has-many-criteria"
* target-role-name="one-criteria-belongs-to-one-report"
* target-ejb="SavedReportCriteria"
* target-multiple="no"
* target-cascade-delete="yes"
*
* @jboss:target-relation related-pk-field="id"
* fk-column="reportid"
*/
public abstract Collection getCriteria();
/**
* set criteria for this report
*
* @ejb:interface-method
*/
public abstract void setCriteria(Collection criteria);
Funny thing is that it all works fine (except the getUsername()) -
3. Re: jboss get() for foreign key on 1-m CMR fails
isakson Aug 8, 2002 12:42 PM (in response to cyates)When you use the get for the relation from the many side, you should be getting the local interface representing the one side of the relation, not its primary key. I've read several times on this forum that you can't get the foreign key in the cmr relation as a cmp field (which I think is what you are asking for).
I suppose you could add a method to your Many object like:
public String getUsername() {
// get the CMR One object related to this Many
OneLocal one = getOne();
// get its CMP field "username"
return one.getUsername();
} -
4. Re: jboss get() for foreign key on 1-m CMR fails
cyates Aug 9, 2002 6:02 AM (in response to cyates)So do I declare "OneLocal getUsername()"? Do I mark that method as CMP or not?
I don't suppose you have the xdoclet tag do you :)?
Thanks a lot.