dipaksavaliya / datanucleus-appengine

Automatically exported from code.google.com/p/datanucleus-appengine
0 stars 0 forks source link

Silent exception (and tx rollback) when using @Version with a date field #141

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
From the spec, @Version can be used with a Date field, so this is correct
config:

    @Version
    @Temporal(TemporalType.TIMESTAMP)
    private Date timestamp;

If you try to use this, datanucleus will fail with a silent exception that
is not logged anywhere, and the transaction will be rolled back. 

Supporting this configuration would be nice, but in any case unreported
exceptions are A Bad Thing. 

Original issue reported on code.google.com by icol...@gmail.com on 9 Oct 2009 at 4:00

GoogleCodeExporter commented 8 years ago
FWIW, the bug seems to be in 
DatastorePersistenceHandler.handleVersioningBeforeWrite()

Original comment by icol...@gmail.com on 9 Oct 2009 at 4:02

GoogleCodeExporter commented 8 years ago
Actually the spec states that it can be used with a Timestamp field, but at the
moment we don't support Timestamp fields whether or not they are Version 
fields. 
Looks like DataNucleus has this wrong for RDBMS as well.  I'm not seeing the 
silent
exception though, I get a nasty stacktrace.

Original comment by max.r...@gmail.com on 28 Nov 2009 at 5:53

GoogleCodeExporter commented 8 years ago
Actually the test is flawed. JPA only supports version fields of types "int, 
Integer, short, Short, long, Long, Timestamp". i.e java.util.Date is not 
included there. Also GAE/J datastore doesn't support java.sql typed fields at 
all. 

See JPA2 spec 11.1.50
<spec>The following types are supported for version properties: int, Integer, 
short, Short, long, Long, Timestamp.</spec>

Original comment by googleco...@yahoo.co.uk on 15 Jul 2011 at 10:12

GoogleCodeExporter commented 8 years ago
Now added support for persisting java.sql.XXX types, and so this will work with 
SVN trunk

Original comment by googleco...@yahoo.co.uk on 15 Jul 2011 at 11:15