-
1. Re: One-To-One Relationship problems
aloubyansky Oct 8, 2002 12:16 PM (in response to paul73)You trying to implement relationships using remote interfaces. Use local instead.
-
2. Re: One-To-One Relationship problems
paul73 Oct 8, 2002 12:45 PM (in response to paul73)Thank you for the suggestion but the problem still remains... I think that the problem is related to the way I use to set the "ChildEntity" in the "MainEntity" Bean.
Now I'm using "local" but, when in the ejbCreate I try to set the ChildEntity field:
TransactionRolledbackException, causedBy:
java.lang.ClassCastException: $Proxy796
Sorry, but I'm new to the J2EE :(
Thanks again
Paul -
3. Re: One-To-One Relationship problems
paul73 Oct 8, 2002 12:49 PM (in response to paul73)Sorry... the code:
/**
* @ejb:interface-method
* tview-type="local"
*
*
* @ejb:relation
* name="Main-child"
* role-name="Main"
* target-ejb="ChildEntity"
* target-role-name="Child"
*
* @jboss:relation
* related-pk-field="ida"
* fk-column="ida"
**/
abstract public ChildEntity getChildEntity();
/**
* @ejb:interface-method
* tview-type="local"
**/
abstract public void setChildEntity(ChildEntity child);
/**
* @ejb:create-method
* tview-type="remote"
**/
public MainEntityPK ejbCreate()
throws CreateException
{
return null;
}
public void ejbPostCreate()
throws CreateException
{
}
/**
* @ejb:create-method
* tview-type="remote"
**/
public MainEntityPK ejbCreate(int id,ChildEntity child)
throws CreateException
{
setId(id);
setName("Pippo");
return null;
}
public void ejbPostCreate(int id,ChildEntity child)
throws CreateException
{
setChildEntity(child);
}
Paul -
4. Re: One-To-One Relationship problems
aloubyansky Oct 8, 2002 1:12 PM (in response to paul73)The code looks ok... except ejbCreate() :)
Note: not only the cmr accessors must be in local interfaces but ChildEntity and MainEntityBean must be local interfaces too.
Confirm this, please. -
5. Re: One-To-One Relationship problems
paul73 Oct 9, 2002 4:47 AM (in response to paul73)Thankx Alex...
now it works!
I've changed everything to "local" as you said :)
Thanx again!