-
1. Re: findByPrimaryKey creates too many instances?
divine_comedy Oct 23, 2003 9:52 AM (in response to woeye)Hm, seems to me like the n+1 issues associated with entity beans ( some CMP container can be smarter ). but here's what I think is supposed to happen when ejbFindByPrimaryKey is called when the data was never loaded before. The first call only "verifies" that the primary key is there, while in ejbLoad, you are supposed to load the real data associated with that primary key. If you see multiple instances being created, check your container configurations, it might be set to "instance per transaction" setting which will cause multiple instances of the same entity bean to be created. I think Home interface must be thread safe by design so you should not need to lookup a Home if you already got one.
-
2. Re: findByPrimaryKey creates too many instances?
msuroo Oct 23, 2003 10:13 AM (in response to woeye)Hi,
As for me I need to have only one instance of Entity Bean per JVM(something like Singleton).
What should I do to reach it?
Should I make something with commit options?
Thanks in advance,
Max -
3. Re: findByPrimaryKey creates too many instances?
divine_comedy Oct 23, 2003 11:42 AM (in response to woeye)As far as I know, Commit Option A by default would only create one instance which is logical. The JBoss folks mention that they are working to make this instance per transaction as well. Not sure if this is in the newer JBoss versions. I myself used 3.0.4.
You can take a look at standard-jboss.xml and see the standard configurations there. If you need any custom configurations, you can specify it in the jboss.xml of your ejb config files and specify that your ejb uses that config.