Page 1 of 1

Problem with Timestamp

Posted: Fri 14 Jan 2011 13:53
by denkhe
I have the following table in my MySQL database :

Code: Select all

CREATE TABLE IF NOT EXISTS Benutzer (
Id            INTEGER        PRIMARY KEY     AUTO_INCREMENT,
Login         VARCHAR(20)    NOT NULL,
Nachname      VARCHAR(50)    NOT NULL,
Vorname       VARCHAR(50)    NOT NULL,
Timestamp     TIMESTAMP DEFAULT 0 ON UPDATE CURRENT_TIMESTAMP
)
In my Visual Studio 2010-edmx the field Timestamp has the following atrributes:

Code: Select all

StoreGeneratedPattern Computed
Type                           DateTime
On inserting a new record into the table I get the following exception:

Devart.Data.MySql.MySqlException: Incorrect datetime value: '0001-01-01 00:00:00' for column 'Timestamp' at row 1.

I need the Timestamp-field to handle concurrency issues.

Version of Devart.Data.MySql.Entity is 6.0.86.0.
Im am using Visual Studio 2010.

Any suggestions?

Best regards
Heiko Denk

Posted: Mon 17 Jan 2011 11:41
by AndreyR
Could you please open the .edmx file in any XML Editor and check that the SSDL part of the model contains the correct StoreGeneratedPattern attribute?
The annotation:StoreGeneratedPattern attribute form CSDL does not influence the code generation, and the property in this case is available in the insert statement.
However, I have performed the tests for MySQL 5.1.40 and 5.0.87, and failed to reproduce the issue. What is the exact version of your MySQL server?

Posted: Tue 18 Jan 2011 07:49
by denkhe
Thank you for your help.

It is working if I add StoreGeneratedPattern="Computed" to the SSDL-Part of the model.

On problem still remains. If I update the Model from database the paramater is gone.

My Version of MySQL is 5.5.8.


Best regards
Heiko Denk

Posted: Tue 18 Jan 2011 09:22
by AndreyR
The reason of this behaviour is the feature of the Microsoft Update Model from Database wizard.
It overwrites the Storage part of the model by design.
You can either manually add the attribute after each update, or, as an alternative, you can add Devart Entity model to your project (Add New Item->Devart Entity model).
It has the same functionality as the Microsoft models do, but in addition it has a more convenient designer (Devart Entity Developer, it is integrated in Visual Studio), and our wizards do not regenerate the storage by default.

Posted: Tue 18 Jan 2011 12:16
by denkhe
I used the Devart Entity model, applied the same changes and now it is working.

One small problem remains. I changed the Name of the entity class (Properties->General->Name) to a different name, which worked fine.

Unfortunately the name is overriden each time I update the model.

Is there a solution to this?

Posted: Wed 19 Jan 2011 18:08
by AndreyR
Thank you for the report, I have reproduced the situation.
I will let you know about the results of our investigation.

Posted: Mon 04 Apr 2011 13:15
by AndreyR
The problem with the name overwriting was fixed. Could you please try the latest 6.10.126 build of dotConnect for MySQL?
Please notify us if the error persists.