-
1. Re: CMP referenced collection
ithehorrible May 4, 2004 9:51 AM (in response to gold)As far as I know you can't specify multiple columns as you're referring to the entire entity, so you should use:
SELECT OBJECT(lic) FROM LICENSE lic WHERE ...
-
2. Re: CMP referenced collection
sesques May 4, 2004 12:14 PM (in response to gold)Hi gold,
I think you can just make JBoss load the entity's one by one by setting the relation read-ahead strategy to "on-load".
Otherwise, define your own finder in which you can do exactly what you suggest.
Pascal -
3. Re: CMP referenced collection
sesques May 4, 2004 3:21 PM (in response to gold)Perhaps try also to limit the page-size (within the relation read-ahead tag) : this is the max number of entities loaded in a single read. This will limit the query size BTW.
Pascal -
4. Re: CMP referenced collection
gold May 5, 2004 4:06 AM (in response to gold)"sesques" wrote:
Perhaps try also to limit the page-size (within the relation read-ahead tag) : this is the max number of entities loaded in a single read. This will limit the query size BTW.
Pascal
Well, Pascal, it works. Thank you.
Actually, I added <read-ahead> section to <defa ults> section of my jbosscmp-jdbc.xml. This completelly solves such issue with DB2.
PS. Own finder is a most evident solution, but it rater a hot fix then a solid design :) -
5. Re: CMP referenced collection
ebrain13 May 10, 2004 1:40 PM (in response to gold)Hi Pascal,
Specifying the read-ahead in the jbosscmp-jdbc.xml fixed the problem, what actually is wrong with the query generation ?
thanks,
-vikram. -
6. Re: CMP referenced collection
sesques May 10, 2004 2:33 PM (in response to gold)Hi vikram,
I'm not in the JBoss gurus confidence, but it seems that the implementation of the CMP engine is just like this.
I think the fisrt query is generated by the CMR collection handler (just querying id's) and the second by the persistence engine which collects all the CMP fields for each entity. The whole optimization here is to factorize all the entity beans in a single query using (id=?) or (id=?) and so on. But the CMP engine seems not to be aware of the originated CMR.
Actually, the best way (means the most performant) to collect "entities in relation with" is to write your own finder with the "one entity" id as parameter.
If we have some chance, the JBoss CMP guru (Alex) will post his advice here.
Pascal