Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » false but not true
false but not true [message #522438] Mon, 22 March 2010 16:08 Go to next message
Tom Eugelink is currently offline Tom EugelinkFriend
Messages: 807
Registered: July 2009
Senior Member
I have a very peculiar situation which has cost me most of the day already.
- If all ordered products are delivered, the associated orderline is set to delivered = true.
- If all orderlines of a single order are delivered, the order itself it set to delivered = true.
- If the user made an error and an amount is reduced, an orderline may be set back to delivered = false and hence the order itself is set to delivered=false.

This is basic redundant information for easy use, enforced by the business model: there is some code at the setAmount that determines the delivered state of the associated orderline, and that again determines the order.
The same code is executed everytime.

The behavior I have is, if the code sets the order:
- back to delivered=false, this is then correctly updated in the database
- to delivered=true, this is NOT written to the database

I know this is a long shot... Anyone seen something like this before?

Tom
Re: false but not true [message #522502 is a reply to message #522438] Mon, 22 March 2010 19:48 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

What was the delivered to begin with? If it was already true, then setting it to true will have no effect, so nothing will be written to the database.


James : Wiki : Book : Blog : Twitter
Re: false but not true [message #522526 is a reply to message #522502] Mon, 22 March 2010 17:02 Go to previous messageGo to next message
Tom Eugelink is currently offline Tom EugelinkFriend
Messages: 807
Registered: July 2009
Senior Member
> What was the delivered to begin with? If it was already true, then
> setting it to true will have no effect, so nothing will be written to
> the database.

It's being toggled. The resulting boolean also means another record is either inserted or deleted, and that record is correctly handled (so when false -> true the record is correctly inserted, when true -> false it is correctly removed).

But once the entity's property is set to false, it stays false. In memory it is set to true, the related record is inserted, but the entity itself is simply not persisted.

Same goes for a text property I update synchronous to the boolean (always append an "x"). When the entity goes from true -> false the text field also is updated, from false -> true it isn't. The EM seems to ignore it.

If I create a small test scenario, it works as expected. So it some circumstantial factor.

Tom
Re: false but not true [message #522701 is a reply to message #522526] Tue, 23 March 2010 16:02 Go to previous messageGo to next message
Tom Eugelink is currently offline Tom EugelinkFriend
Messages: 807
Registered: July 2009
Senior Member
Well, I patched things by executing a native SQL after the transaction is committed. Not great, but it works for now...

Tom
Re: false but not true [message #523216 is a reply to message #522438] Thu, 25 March 2010 14:54 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Sounds like you may have two different copies of the object. When the error occurs, does it cause a rollback, this would clear the persistence context. Are you using flush() or anything else different?

Otherwise, you would probably need to get your simple example to reproduce the issue.


James : Wiki : Book : Blog : Twitter
Re: false but not true [message #523222 is a reply to message #523216] Thu, 25 March 2010 15:11 Go to previous message
Tom Eugelink is currently offline Tom EugelinkFriend
Messages: 807
Registered: July 2009
Senior Member
> Sounds like you may have two different copies of the object. When the
> error occurs, does it cause a rollback, this would clear the persistence
> context. Are you using flush() or anything else different?

There is no error, since it is a redundant value. The change simply is not persisted, but all other related entities are.


> Otherwise, you would probably need to get your simple example to
> reproduce the issue.

Yeah. I know. But then the word "simple" can be striked. The example are the actual BM actions as they are performed by the user through the Swing GUI, and they work ok.
Hmmmmmmmm, maybe someday I'll find the time. Right now I'm ok with seeing if I stumble over the cause somewhere in the future.
Previous Topic:Unsupported Driver.getClientInfo() operation when Eclipselink 2.0.0 accesses TimesTen 11.2.1
Next Topic:JPA and historic sessions, HistoryPolicy, etc.
Goto Forum:
  


Current Time: Sun Dec 21 19:35:34 GMT 2014

Powered by FUDForum. Page generated in 0.08261 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software