This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
Hi, I have the following two questions regarding Enterprise Beans.
1. Can an Entity Bean map to two tables in the database. If yes, how can it be done. 2. Can we have a 'synchronized' method in an Enterprise bean. Reasons for both the answers ('yes' and 'no'). Waiting for answers, Thanks.
It is possible to have a synchronized method in an ejb, but it might not be a good idea ... one of the ideas behind ejbs is that low level things (like threading) should be handled by the container and if you start coding them yourself, it may interfere with what the container is doing. There was an article in javaworld on what you can but shouldnt do in ejbs, and that was one of the things they mentioned.
Can answer just one... Sure, you can have synchronized methods in your EJB. Not that it makes any difference. The container will not allow more than a single thread to access your EJB object anyway, and you may not spawn your own threads that might do this.
Originally posted by Smita Kulkarni: [B]Hi, I have the following two questions regarding Enterprise Beans.
1. Can an Entity Bean map to two tables in the database. If yes, how can it be done. >> With CMP u can't do it directly except that of using views. The Other way is to use BMP and write ur own implementations for ejbCreate and ejbPostCreate... Reply me if there is any other way.... 2. Can we have a 'synchronized' method in an Enterprise bean. Reasons for both the answers ('yes' and 'no'). >> We can have it but it will directly affect the performance becaz threading is handled completely by Containers of Application server and dont know the way of their handling. And Containers uses single threading model, but still there is a way called reentering the bean. For more help u can refer orielly's EJB book *3rd or 4th chapter i dont remember exactly... Chalo bye Regards. Badal