Re: Problem re-executing adaptor operations
Re: Problem re-executing adaptor operations
- Subject: Re: Problem re-executing adaptor operations
- From: Chuck Hill <email@hidden>
- Date: Fri, 19 Feb 2010 10:04:06 -0800
On Feb 19, 2010, at 6:58 AM, Jean-Francois Veillette wrote:
Le 10-02-18 à 13:23, Chuck Hill a écrit :
On Feb 18, 2010, at 8:20 AM, Jean-Francois Veillette wrote:
For no obvious reason, eof tries to save operations twice to the
bd, all within the same 'saveChanges'.
hand-crafted log reduction for simplicity (full log at the
end) ...
"ReclRepresentantLegal"@13255337 expression took 3 ms: INSERT
INTO recl_representant_legal(pk) VALUES ( ?) withBindings:
1:4239[pk]
"ReclDossierReclamationLoi73_2009"@13255337 expression took 5
ms: INSERT INTO recl_reclamation( pk) VALUES (?) withBindings:
18:815[pk]
"ReclEcritureG2"@13255337 expression took 2 ms: INSERT INTO
recl_ecriture_g2(pk) VALUES (?) withBindings: 5:11338[pk]
"ReclRepresentantLegal"@13255337 expression took 3 ms: INSERT
INTO recl_representant_legal(pk) VALUES ( ?) withBindings:
1:4239[pk]
com.webobjects.eoaccess.EOGeneralAdaptorException:
EvaluateExpression failed:
<com.webobjects.jdbcadaptor.MicrosoftPlugIn$MicrosoftExpression:
"INSERT INTO recl_reclamation(pk) VALUES (?)" withBindings:
18:815(pk)>:
It does look like it fails after the ReclEcritureG2 and try to
rerun the whole list of adaptor operations.
It might do that if it thought it lost connection to the
database. Does it open a new transaction?
I'm on WO5.3.x (latest), a recent checkout of Wonder, MS-
SQLServer 08.00.2055, fresh copy of sqljdbc.jar.
Strange thing is that it does sometime work, when I run it in
the debugger, it sometimes get through. I have not found
anything different from a success-run and the usual failed-run
other than the time spent in the debugger.
Does anyone have any idea where it could come from ?
Any clue where I could look at ?
Can you look at the database log (not the EOF log from EOF) and
see if any errors are being returned?
The problem actually came from a hidden sql command.
Only hidden because my log was showing successuf sql request with
the entity and time something wonder does.
When Pascal figured out to log SQL before they where sent to the
db, I was able to debug and see which one failed. It was a
problem with some new tables.
Is there a way to 'raise' instead of 'swallow-and-retry' when
there is a db exception ?
It should raise already. Maybe this happens because of the "hidden
SQL command"? What exactly are you doing?
I was saving 60% in the databse like so:
"INSERT INTO recl_info_agent(pourcentage_estime, pk,) VALUES (?, ?)"
withBindings:
1
:
0.59999999999999997779553950749686919152736663818359375
(pourcentageEstime), 2:432(pk)>
Now I'm not sure if it just the logger that show the bigdecimal like
that or if it really is what is sent to the db.
But with such a number it fail and the same command with a
reasonable (0.6) number will succeed.
The property in the eomodel is defined as:
externeal type: decimal
class: java.math.BigDecimal
DataType: Big Decimal B
precision: 8
scale: 4
To fix it I had to overwrite the validator
"validatePourcentageEstime(Object o)" and set the scale of the
BigDecimal received.
I tought that my formatter was doing enough, defined like so:
DecimalFormat formatPourcent = formatPourcent = new
DecimalFormat("0.0");
formatPourcent.setMinimumFractionDigits(2);
formatPourcent.setMultiplier(100);
formatPourcent.setMaximumFractionDigits(4);
I'm sure I miss something and doesn't need to overwrite
validatePourcentageEstime, how do you do ?
Ah ha! That formatter is NOT doing what you think it is:
From the JavaDocs:
Currently, the only classes that parse returns are Long and Double,
but callers should not rely on this.
It is returning a Double and KVC (or EOF?) is creating from that. You
either need to to set the scale in the validate method, or create a
BigDecimalFormat that does the right thing. So that explains why you
were getting the SQL error.
Is it a problem with my plugin ? the mssql jdbc adaptor ?
I have not seen this happen my MS SQL, but I may not have caused
this exact situation. It could be that the MS SQL adaptor is mis-
interpreting the database errors as a "lost database connection"
error.
Are you doing anything in your code that is not simple, ordinary EOF?
No, nothing special ... almost ...
We use a custom mssql plugin that Francis wrote based on jtds, but I
looked at the code and didn't see code related to transaction
handling ... but maybe I missed something.
I also switched to the publicly available mssql jdbc adaptor, with
wonder's plugin and the framework you wrote available from your site
(Chuck) ... same problem, retry all the transaction's operations.
It does sound like there is a bug in that plugin that interprets the
error from the overflow as a "lost database connection" error.
Chuck
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden