Oh, I thought you wrote one-to-many unidirectional.  Anyway, the cmr code is
to agressive when adding and removing relationships.  I'm going to look at
this soon, because it is in the way of another feature.

-dain

> -----Original Message-----
> From: Langelage, Frank [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, December 12, 2001 1:13 AM
> To: Dain Sundstrom
> Cc: [EMAIL PROTECTED]
> Subject: Re: [JBoss-dev] RH, CMR: very bad performance
> 
> 
> No, I am not doing something like this.
> In my SLSB I do:
>       itemGroup = itemGRoupHome.findByPrimaryKey( x );
>       unitOfMeasure = unitOfMeasureHome.findByPrimaryKey( y );
>       item = itemHome.create( id, desc1, desc2, ..., 
> itemGroup, unitOfMeasure
> );
> 
> The CreateMethod ejbCreate(...) in ItemEJB.java contains:
>       setId( id );
>       setDesc1( desc1 );
>       setDesc2( desc2 );
>       :
> The corresponding ejbPostCreate(...) then contains
>       setItemGroup( itemGroup );
>       setUnitOfMeasure( unit );
> 
> That's all. Method ItemGroupEJB.getItems() does not exist, because I
> only want a unidirectional relationship from Item to ItemGroup.
> 
> 
> Frank
> 
> 
> Dain Sundstrom schrieb:
> > 
> > Yep, this is quite inefficient.  Based on the information 
> you have provided
> > I assume you are doing something like this in postCreate
> > 
> >         myItemGroup.getItems().add(thisItem);
> > 
> > My code loads the collection from the database as soon as 
> you call getItems.
> > This is a bit aggressive as you man not even use the 
> collection.  Even if I
> > fixed that, there is another load everything call in the 
> add method, which
> > is unnecessary for add and remove.
> > 
> > I'll fix this when I get done with the readonly relation code.
> > 
> > Can you file a bug report on this at sf?
> > 
> > -dain
> > 
> > 
> > > -----Original Message-----
> > > From: Langelage, Frank [mailto:[EMAIL PROTECTED]]
> > > Sent: Tuesday, December 11, 2001 4:37 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: [JBoss-dev] RH, CMR: very bad performance
> > >
> > >
> > > Hi,
> > >
> > > I have 3 beans: Item, ItemGroup, UnitOfMeasure.
> > > Item has a foreign key reference to ItemGroup and a reference to
> > > UnitOfMeasure, but not the other way around.
> > > So this are two "many to one relationships, unidirektional".
> > >
> > > I traced the executed SQL's and found out the following:
> > > Executing and ItemHome.create(...) with all fields of item in the
> > > argument list, this SQL's are executed:
> > > "select count(*) from item where id = ?"
> > > "insert into item ( id, description1, ... ) values ( ?, 
> ?, ...)" (all
> > > fields without itemgroup_id and unifofmeasure_id).
> > > After this "select description from item_group where id = ?" is
> > > executed.
> > >
> > > OK so far, but now ...
> > >
> > > "select id from item where itemgroup_id = ?" is executed 
> and all the
> > > results are fetched (JDBCFindByForeignKeyCommand).
> > >
> > > The more items are created the longer it takes to add a new one.
> > > I get an horrible high count of database read calls for only
> > > a few data
> > > written.
> > >
> > >
> > > Frank
> > >
> > > _______________________________________________
> > > Jboss-development mailing list
> > > [EMAIL PROTECTED]
> > > https://lists.sourceforge.net/lists/listinfo/jboss-development
> > >
> > 
> > _______________________________________________
> > Jboss-development mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/jboss-development
> 
> _______________________________________________
> Jboss-development mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-development
> 

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to