views:

109

answers:

1

hello all!

I tried running the sample GWT/Google Appengine application - expenses generated by ROO using the roo command "script expenses.roo" (as advised here)...

This app uses datanucleus-core - 1.1.6 and a HSQLDB as the in-memory database.

I was able to run the application and successfully store and retrieve Employee objects. (These Employee objects do not have any date type fields but have only string and int fields).

But I am having problems storing the 'Report' objects with the App printing an error message 'Unexpected Server Error'. Looking at the logs and debugging, this unexpected error happened because of trying to store null in a not null date type field ('created' date field)

This is where it gets complicated... Looking at the source code for this Report class, the 'created' date field is not specified as a 'not null' field (missing the @notnull annotation). To confirm this I changed the databse to Postgresql and inspected the auto-generated schema and found that this date field is indeed marked as 'not null'.

This means that DataNucleus during auto-schema generation always marks date fields as 'not null'.

I further confirmed this by changing the ORM library to Hibernate and the same code worked with out any problems and was able to save report objects with date fields in both HSQL and Postgres DB.

Is it a bug with the DataNucleus and is anyone else seeing this problem?

I am lost...

Thanks in advacne.

Deepak

+1  A: 

I've used DataNucleus as JPA with many date fields (as timestamp, or DATE) and had no problem at all. SchemaTool always creates them as "NULL" in the DDL (allowing nulls). Since you don't quote the Entity class or the logs no help more available