openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Todd Nine <>
Subject Re: StateManager setup with embedded entity handling in Cassandra plugin
Date Fri, 08 Apr 2011 02:02:51 GMT
Hey Rick.  

I'm attempting to re-create it in my test here, but I'm not having any
luck.  It's something specific in our app.

Test case is embeddedFieldOnlyDirty.

Essentially I'm using an open session in view pattern in our webapp
which binds and entity manager to the thread via spring.  These are the
steps that occur, the issue seems to be on flushing during commit.

entity manager created

transaction started

load Customer with embedded phone  Embedded phone has it's own
StateManager, which points to the Customer's StateManager, as it's
parent.  This all seems correct

transaction commit.  Both state managers are still correct.

Web UI makes changes to Address object and calls business tier

transaction starts

em.persist is invoked.  At this point both the Customer and Address have
correct StateManagers.  The state manager on customer shows the address
field as dirty, and the state manager on address shows the field that
was changed via the web ui as dirty.

transaction is committed.

When "flush" is invoked on my plugin during the commit operation,
address is present, but all fields are null, and the statemanager is not
the same instance that was present before the commit operation.  It's
almost as if the Customer stateManager does not properly cascade to the
Address SM during the commit.

My explanation above is for the test which demonstrates the issue.
Hopefully my test makes the problem I'm having clear.  


todd nine| spidertracks ltd |  117a the square 
po box 5203 | palmerston north 4441 | new zealand 
P: +64 6 353 3395
E: W: 

On Thu, 2011-04-07 at 20:06 -0500, Rick Curtis wrote:

> Todd -
> I'm somewhat confused as to where you are running into problems.
> Perhaps you can write a small unit test that will better describe what
> you're having problems with?
> Thanks,
> Rick
> On Wed, Apr 6, 2011 at 7:42 PM, Todd Nine <>
> wrote:
>         Hi all,
>          I'm having a very difficult time working with embedded
>         entities in
>         Cassandra.  Specifically, this is the case where I'm getting
>         very
>         strange behavior.    Em = Entity Manager.
>         em1 created
>         em1 begin transaction
>         em 1 load User entity , the embedded Address object is
>         correct.
>         em 1 complete transaction
>         User entity is now detached.
>         Address is updated
>         em 1 begin transaction
>         User is attached
>         em 1 flush
>         em1 commit transaction
>         The Address now has a null entity manager, and all fields are
>         null,
>         however it is correct when the entity was passed to the flush
>         operation
>         before using StateManager.get(fieldId) to retrieve the
>         embedded object.
>         For the cassandra plugin in it's first implementation, we're
>         requiring
>         all @Embeddable entities to also implement Serializable.  The
>         embedded
>         entity value is simply serialized to a column
>         Here is the embedded column implementation I have created for
>         @Embedded
>         and @ElementCollection
>         Any guidance would be greatly appreciated.  I know I'm not
>         wiring the
>         entity manager correctly during load, I'm just unsure what
>         else I need
>         to do.  I've looked at both ElementEmbedValueHandler and
>         EmbedFieldStrategy, however I'm not getting anywhere.  Any
>         help would be
>         greatly appreciated.
>         Thanks in advance!
>         Todd

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message