This is JBoss preloading additional rows of data. It is the on-load read-ahead strategy. This is discussed in the JBossCMP documentation.
I'm still confused. It makes sense for the read-ahead strategy to be used when the data is initially read before it is selected. But why is it reading ahead in the ejbPostCreate where it is setting the cmr fields for the ProjectPhase? Shouldn't it just be using the id values that were passed in?
public void ejbPostCreate(
StatusLocal status) throws CreateException
The only difference I could see was that Status and Phase are defined as read-only, while the Project is updatable. BTW, I forgot to mention that I'm running this on 3.0.1RC1.
Ss far, I haven't had any luck trying to get Xdoclet to merge read-ahead tags anywhere in the jbosscmp-jdbc.xml file.
After revving up the Trace debug and seeing the sql that was being generated, I found the problem. I needed to specify @ejb-relation target-multiple="yes". Now I don't understand why the Project cmr field was working, but I changed it to be the same and it still works, so I'm happy %^)
I have a similar problem when I do the following :
I need to update the language of an article (they are related via a cmr field on article, unidirectional 1 on 1).
I have as parameters the article id and the id of the new language.
First I retrieve the article (findByPrimaryKey).
Next, I retrieve the language in the same way.
When I try to set the new langauge (article.setLanuage(newLanguage)), it gives me also the 'preload data contains multiple values, but this cmr field is single valued'.
In the trace debug, I noticed that the error happens in the remove relation method. Further inspection showed me that when I try to set the language, it retrieves ALL articles which are also related to that language. And can't find a reason why this should happen.
Does anyone have an explanation for this behaviour?
I was wondering if I could solve the problem by not using the findByPrimaryKey for the article. But instead using a select method?
Could this solve my problem?
I have attached my server loggings as wel as the code that I execute ...