Dain Sundstrom wrote:
I've been sucked into another project and haven't been paying much attention to the lists...

The problem is we flush before returning the created object to the caller. The reason we do this is because database generated fields are not filled in until the flush statement which means the primary key is not guaranteed to be available until flush. The current code requires the primary key to create the cmp proxy we return to the caller. The code will have to be changed to allow for late primary key resolution either when the code calls getPrimaryKey or at the end of the transaction.

I don't have the time to look at this, but I can help you if you want to work on it.
I've started poking around in the code trying to understand what needs to change. Is the JpaCmpEngine.createBean() method where the flushing takes place? It appears at that point in time that the primaryKey is used for 1) creating the ThreadContext instance, 2) ror storing the bean in the transaction cache, and 3) for creating the ProxyInfo instance. Am I looking in the correct location for this?

The ThreadContext primary key bit looks easily changed to a lazy resolution, and probably the ProxyInfo as well, but the transcaction cache does not appear to be as easily changed, since the primary key is the main lookup method for the transaction cache. I guess the transaction cache step could be bypassed until the primary key is actually generated, but I'm concerned that this could result in some resolution failures where an object would be expected to be located in the cache. Any pointers on where the end of transaction processing would need to be performed?

Rick


-dain

On Apr 3, 2008, at 10:43 PM, Kevan Miller wrote:
A Geronimo user had reported a performance problem w/ CMP as described below. Any thoughts?

I'd tried to forward to [EMAIL PROTECTED] a while back, but looks like I sent to a bad email address, instead...

--kevan

On Feb 26, 2008, at 9:54 PM, ApolloX wrote:


Is there a way to configure when commands are flushed to the database for EJB2 CMP beans in G2? I noticed something that may be related to the severe caching/performance slowdown from trying to migrate CMP2 beans from G1 to
G2.

Here's a concrete example of the behavior:

AdminLocalHome movieHome = (MovieLocalHome)
context.lookup("java:comp/env/ejb/MovieLocal");
MovieLocal newMovie = movieHome.create(someId);
newMovie.setTitle("The Matrix");

In G1, this code worked fine because the database INSERT was delayed until
after the setTitle() was called.  In G2, the INSERT happens immediately
after the call to create() leading to a database insertion error since title
is a required field in the database.

Could someone provide me with a solution to delay the database flushing
until later on? As I've said, I don't get the impression anything is being cached for CMP2 beans in G2 based on the severe performance slowdown I've
seen.

ApolloX

--
View this message in context: http://www.nabble.com/CMP2-on-G2---Delayed-Database-Flush-tp15704963s134p15704963.html Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.





Reply via email to