> Does anyone uses CMP 2.0 many to many relationship
> with JBoss 3.0alpha?
Yep they work fine.
> Or tries the J2EE Tutorial AppRoster example by Sun
> on JBoss?
Nope haven't seen it.
> I don't understand why the relationship setting
> if the database table are empty when I first deploy
> my application and doesn't work the second time when
> database table aren't empty.
You're going to need to be more specific. Please post the important log messanges, and revelent portions of the deployment descriptors.
I posted ejb-jar.xml, jboss.xml, jbosscmp-jdbc.xml and source some threads above, the thread's name is:
"Does many to many relationship work in Jboss3.0 ? "
I try to create two entity bean with a many to many relationship, if I create some entity of both bean,
then I restart the server without deleting the tables,
and I set a relationship between two or more entities
jboss log this is the error:
A CMR field cannot be set or added to a relationship in ejbCreate; this should be done in the ejbPostCreate method instead.;
at java.lang.reflect.Method.invoke(Native Method)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
It seems the point has been missed here, is that
many-to-many works great. You can do whatever you like
with either side of the relationship (add/delete). BUT
once you restart jboss or redeploy - all adds fail.
The only way out is to drop the relationships table and
The problem is in the Alpha version - i bet (and hope)
its fixed in the next release.
I stopped this problem from occuring by getting
revision 1.10 of JDBCCMRFieldBridge.java, and comment
out the check in addRelation(). This basically undoes that change (1.10) or you can get (1.9), but I wanted to see what was going on. After compiling, replace the class in lib/ext/jboss.jar.
Is there an easy way of getting a source dump of Jboss
without using cvs (Just a click and download a .tgz file?)
Is this what snapshot are ?
Anyway snapshot urls give me "not found" Http errors
Good luck. Nick.
Dear Michele! Your code doesn't work because "A CMR field cannot be set or added to a relationship in ejbCreate; this should be done in the ejbPostCreate method instead".
You shoud not add children to this or other EJB in the ejbCreate method. Are you doing it? Check it and move the appropriate code to the ejbPostCreate method. It has the same parameters as the ejbCreate, so it is easy to do.
But I can say that even after that you program may not work because of some bugs in transaction management in JBoss 3.0alpha. I have a good suspiction about them and the letters in this thread about lost records put my suspictions into assurance.
Wish you success. Alexander.
I try your patch and now JBoss3.0 works!
Your are very clever and I thank you very much.
But i don't understand a thing ...
Why only you and me have reported this problem?
Why has no one ever found this error?
I think is a bad thing that persistent management
system can't works after a restart without the
lost of all the data :-(
For Lepekhin, I don't write anything in ejbCreate,
I posted the source of my bean in the thread named
"Does many to many relationship work in Jboss3.0 ?".