This is a bug in 3.0.  It has been fixed in 3.0.1.

-dain

[EMAIL PROTECTED] wrote:
> hi,
> 
> i'm working with an object were two objects refer to each other. i.e.
> 
>     public abstract class Type implements EntityBean {
>         /* snip */
>         public void ejbPostCreate(String name) throws CreateException {
>             TypeLocal type = null;
>             ResourceLocalHome resourceLome = null;
> 
>             /* skip this part if we're the root */
>             if (name.equals("root")) {
>                 return;
>             }
> 
>             try {
>                 type = TypeUtil.getLocalHome().findByName("root");
>                 resourceLome = ResourceUtil.getLocalHome();
>                 typeLocal =
>                     typeLome.findByName("root");
>             } catch (Exception e) {
>                 /* snip */
>             }
> 
>             setResource(resourceLome.create(type));
>         }
>     }
> 
>     public abstract class Resource implements EntityBean {
>         public void ejbPostCreate(TypeLocal type) {
>             setType(type);
>         }
>     }
> 
> so, every Resource has a Type and every Type is a Resource unless it's
> the root Type. for some reason when I call setResource() from
> Type's ejbPostCreate() nothing happens. no UPDATE statements for the Type
> table are generated.
> 
> in the database i see
> 
>     => select * from type ;
>      id  |  name    | resource_id 
>     -----+----------+-------------
>      397 | root     |            
>      398 | type_one |            
>      399 | type_two |            
>     (3 rows)
>     
>     => select * from resource;
>       id  | type_id
>     ------+--------
>      1485 |     397
>      1486 |     397
>     (2 rows)
> 
> if i call setResource() outside of ejbPostCreate() this works fine.
> the same behavior is also happening with other entities that are also
> Resources and have a ejbPostCreate() that's similar to Type's.
> is there something particular about updating a CMR from within ejbPostCreate
> that is different?
> 
> the following is the dd for this particular CMR.
>       <ejb-relation >
>          <ejb-relation-name>type-resourceid</ejb-relation-name>
>          <!-- unidirectional -->
>          <ejb-relationship-role >
>             
><ejb-relationship-role-name>type-is-a-resource</ejb-relationship-role-name>
>             <multiplicity>One</multiplicity>
>             <relationship-role-source >
>                <ejb-name>Type</ejb-name>
>             </relationship-role-source>
>             <cmr-field >
>                <cmr-field-name>resource</cmr-field-name>
>             </cmr-field>
>          </ejb-relationship-role>
>          <ejb-relationship-role >
>             
><ejb-relationship-role-name>a-resource-may-be-a-type</ejb-relationship-role-name>
>             <multiplicity>One</multiplicity>
>             <cascade-delete/>
>             <relationship-role-source >
>                <ejb-name>Resource</ejb-name>
>             </relationship-role-source>
>          </ejb-relationship-role>
>       </ejb-relation>
> 
> Any suggestions are much appreciated.
> 
> barbee.
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> No, I will not fix your computer.
> http://thinkgeek.com/sf
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
No, I will not fix your computer.
http://thinkgeek.com/sf
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to