-
15. Re: CMR Fields not being persisted
rollc Aug 7, 2002 12:33 AM (in response to pazu)This appears to be working in 3.0.1RC1 w/ Catalina. Thanks, Dain.
-
16. Re: CMR Fields not being persisted
jhudsy Aug 13, 2002 10:29 AM (in response to pazu)Hi...
This bug still exists in 3.0.1, I have just submitted a bug report to sourceforge.
Cheers
Nir Oren -
17. Re: CMR Fields not being persisted
dpasek Aug 18, 2002 2:32 PM (in response to pazu)Hi,
I also have still the same problem. Funny thing is, that after switching to 3.0.1 the problem was gone for 1:1 relationships. These work fine now, but for 1:m relationships it still seems to be broken.
After assigning a collection of EJBs with the CMR Setter method the FK in the many table is still NULL.
looking into my logfiles (JBoss and mySQL) I can see, that the update calls for the "many side" are called but contain as new FK the value null:
JBoss log:
2002-08-18 19:38:59,839 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand.SearchWordEJB] Executing SQL: UPDATE searchwords SET dataDescriptionEJB=? WHERE id=?
2002-08-18 19:38:59,852 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand.SearchWordEJB] Rows affected = 1
MySQL log:
10 Query UPDATE searchwords SET dataDescriptionEJB=null WHERE id=3
With the 3.0.0 version these update statement were missing.
Spent a lot of time checking my code but it seems to be a JBoss problem.
Greetings
Denis
PS: @jhusdy what's the number of your bug report at SourceForge? -
18. Re: CMR Fields not being persisted
dpasek Aug 18, 2002 4:29 PM (in response to pazu)Hi again,
> Spent a lot of time checking my code but it seems to
> be a JBoss problem.
:-) First post is obsolete now.
I changed my code a little bit and now it works perfectly, but I still don't know why the old version was broken:
This is the "good" code:
Collection searchWordEJBs = this.getSearchWordEJBs();
Collection newEJBs = new Vector();
for (Iterator colIt = searchWords.iterator(), ejbIt = searchWordEJBs.iterator(); colIt.hasNext(); ) {
String searchWord = colIt.next().toString();
if (ejbIt.hasNext()) {
SearchWordLocal searchWordEJB = (SearchWordLocal)ejbIt.next();
searchWordEJB.setSearchWord(searchWord);
newEJBs.add(searchWordEJB);
} else {
try {
SearchWordLocalHome searchWordHome = this.getSearchWordLocalHome();
newEJBs.add( searchWordHome.create(searchWord) );
} catch (NamingException mEx) {
...
} catch (CreateException mEx) {
...
}
}
}
this.setSearchWordEJBs(newEJBs);
This is the "bad" code:
Collection searchWordEJBs = this.getSearchWordEJBs();
Collection newEJBs = new Vector();
for (Iterator colIt = searchWords.iterator(), ejbIt = searchWordEJBs.iterator(); colIt.hasNext(); ) {
String searchWord = colIt.next().toString();
if (ejbIt.hasNext()) {
SearchWordLocal searchWordEJB = (SearchWordLocal)ejbIt.next();
searchWordEJB.setSearchWord(searchWord);
} else {
try {
SearchWordLocalHome searchWordHome = this.getSearchWordLocalHome();
newEJBs.add( searchWordHome.create(searchWord) );
} catch (NamingException mEx) {
...
} catch (CreateException mEx) {
...
}
}
}
searchWordEJBs.addAll(newEJBs);
this.setSearchWordEJBs(searchWordEJBs);
The only difference is that I do not create a completly new collection for all EJBs (updated and new ones) in the "bad" code but merge the Collection afterwards.
The bad code than causes an update for all FKs with null.
Any ideas why?
Greetings
Denis
PS: Are there any possibilities to do some code formatting??