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