SQLContainer can't handle null value TIMESTAMP!?

Hi,

I’m having trouble with inserting an (oracle.sql.TIMESTAMP) object into an Oracle DB TIMESTAMP field (HS_DATE).
When my Vaadin application reaches the statement given below:

rItem.getItemProperty("HS_DATE").setValue(null); it throws the following error message:

Jul 09, 2015 12:20:26 PM com.vaadin.server.DefaultErrorHandler doDefault SEVERE: java.lang.NullPointerException at com.vaadin.data.util.sqlcontainer.query.generator.StatementHelper.handleNullValue(StatementHelper.java:152) at com.vaadin.data.util.sqlcontainer.query.generator.StatementHelper.setParameterValuesToStatement(StatementHelper.java:78) at com.vaadin.data.util.sqlcontainer.query.TableQuery.executeUpdate(TableQuery.java:553) at com.vaadin.data.util.sqlcontainer.query.TableQuery.storeRow(TableQuery.java:288) at com.vaadin.data.util.sqlcontainer.SQLContainer.commit(SQLContainer.java:1023) When replacing null by for example new TIMESTAMP() is works, but I want the field in the database to contain a null value and NOT the date value 01-JAN-70 12:00:00!

How can this be accomplished?

By the way I use Vaadin 7.2.0!

Regards,
Gerard

Hi,

you seem to be using the oracle-specific Timestamp class, which we cannot support directly without making Vaadin dependant on Oracle class(es) which is not reasonable.

Please see the ticket at
https://dev.vaadin.com/ticket/9148
for a solution to your issue. In short you need to override com.vaadin.data.util.sqlcontainer.query.generator.StatementHelper.handleUnrecognizedTypeNullValue -method.

-tepi

Hi,

Thanks for your answer!

But what alternative do I have compared to the Oracle specific Timestamp class?

Thanks for your solution regarding overwriting methods of the OracleGenerator StatementHelper class, but that is currently a too complicated track, sorry!

Regards,
Gerard

Hi,

unfortunately with Oracle DB I don’t think you have any other alternative. We can’t make Vaadin depend on Oracle packages so the only option is to override the necessary methods at the application level. I know it’s bad but I don’t see a better solution.

-tepi

Hi,

I think you are right that the proper way to tackle this issue is to override the required methods, but that takes me far too much time to accomplish, because I’ve no experience in doing that!

So, a hint on how to start doing that might be very welcome!

Regards,
Gerard