Oracle Precision - Check generated in Model ORA-01438

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
software931
Posts: 11
Joined: Tue 18 Sep 2012 07:55

Oracle Precision - Check generated in Model ORA-01438

Post by software931 » Fri 11 Jul 2014 12:55

Sometimes we have the problem, that the values in model are larger than Oracle column definition.
Example: Oracle type is NUMBER(3,1), but given value is 10000.

If you try to store this to database, on oracle error is generated ORA-01438.

Is there a possibility, to generate automatically an exception, when a value greater then Oracle definition is set to the model value ?

P.S.:
Can this check be generated automatically, if this possibility exists, or must I adapt this manually column by column?

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Oracle Precision - Check generated in Model ORA-01438

Post by MariiaI » Tue 15 Jul 2014 05:37

You can set the validation rules for entity properties. To do it, please open your model, in the Model Explorer (the Model Explorer can be opened by selecting Model Explorer from the Entity Developer submenu of the Tools menu) select Properties from the context menu of the used template (e.g. DbContext) and set the Validation Framework property to Data Annotations.
After you have made these changes, select a particular class property on a diagram (or in Model Explorer) and initialize the needed attributes in the Validation section in the Properties window. Save the model to regenerate the code (the code will be regenerated with all necessary attributes).
For example:

Code: Select all

[System.ComponentModel.DataAnnotations.Range(typeof(double), @"0", @"100")]
public virtual global::System.Nullable<double> VALUE
...
Please refer to the corresponding topic in the Entity Developer documentation: Basic Workflows-> Code Generation-> Entity Property Validation.

If this information doesn't help or you have any further questions, feel free to contact us.

Post Reply