Please use the google group to ask questions - thanks.

by Claudio 23 Mar 13:18
Optimistic Concurrency Checking on Oracle

Hi Rob,
I have problems updating a record on Oracle: I think the problem is optimistic concurrency checking with all columns.

Inserting the record all works:

trans[1003], 13:25:33.207, insert into CISE_DICHIARAZIONE (id, protocollo_inps, data_presentazione, codfis_dichiarante, ise, isee) values (?, ?, ?, ?, ?, ?)
trans[1003], 13:25:33.207, Binding Insert [CISE_DICHIARAZIONE] set[id=12, protocolloInps=aaaa, dataPresentazione=null, codfisDichiarante=, ise=null, isee=null, ]
trans[1003], 13:25:33.223, Inserted [verificheise.model.Dichiarazione] [12]

If i try to update i have an error: Data has changed. updated [0] rows

trans[1004], 13:25:38.457, update CISE_DICHIARAZIONE set protocollo_inps=?, data_presentazione=?, codfis_dichiarante=?, ise=?, isee=? where id=? and protocollo_inps=? and data_presentazione is null and codfis_dichiarante=? and ise is null and isee is null
trans[1004], 13:25:38.457, Binding Update [CISE_DICHIARAZIONE] set[protocolloInps=aaaa, dataPresentazione=null, codfisDichiarante=a, ise=null, isee=null, ] where[id=12, protocolloInps=aaaa, dataPresentazione=null, codfisDichiarante=, ise=null, isee=null, ]

I think the problem is using the empty string instead of null for selecting the row: ... where ....codfisDichiarante=... because Oracle treats the empty string ('') as null and so no row is selected.

Am I doing something wrong?



23 Mar 20:05
by Rob

Well, I think this is a bug in Ebean ... Yes, Oracle treats empty strings as null and I'm thinking Ebean is not taking that into account.

So yeah, I'll look into it but my guess is that is the problem.

Looking at the update statement it is very likely that is the issue (dataPresentazione=null in the where clause).

Thanks, Rob.

25 Mar 12:10
by Rob

Logged as

Fixed in HEAD.

The next release (v1.1.0) is due out by 31 March.

Thanks, Rob.

Create a New Topic

Introduction User Guide (pdf) Install/Configure Public JavaDoc Whitepapers
General Database Specific Byte Code Deployment Annotations Features
Top Bugs Top Enhancements