Database inconsistency for static entities

Database inconsistency for static entities

  

Hi,

I have a question about how a static entity should work. 

Example: I have a static entity "MenuType", that has some records. Each record has multiple attributes.

One of the attributes is set to a value (another static entity record). If I changed that attribute to another one, and I look in the DB tables in Oracle, I can see that it was changed. 

The problem is that if i delete that value from the attribute (let it empty), and then i publish the module, and then I look again in the tables (Oracle), the last value is still in there. (not null as expected).

I did not see any warnings in the Service Studio regarding this.

Is this the expected behavior?

Thanks! 

Hi Stefan,

This is not expected behaviour, but though I've used the scenerio you describe myself, I've never seen any problems with it. Are you sure you're looking to the right data? What happens when you query the static entity after publish (from within Service Studio)?

Hi Kilian,

I have looked in that entity in Service Studio, and i have there a value for that attribute (an identifier from another entity - ID - it should be NULL, as I said). 

I have discovered this because on an Environment we had an inner join on this attribute and we got the desired results, but when we deployed to another environment, because of that inner join we did not get anything. (checked that table on that environment and there we had NULL for that attribute - as it should be).



Hi Stefan,

I don't quite understand. Are you saying that when you look at the Entity's definition in Service Studio, the Identifier is there, or that when you query the Entity in SS the Identifier is there?

Hello Stefan,

If you "null" a value you are assign it the default value. What you have in the data base records, I believe, are those default values. The section about basic data types contains the overview, but here are some examples:

TypeDefault ValueExampleComment
Boolean
false
true or false
 
Currency
0.0
545870.025
See Decimal type.
Date
#1900-01-01#
#1988-08-28#
Minimum value: #1900-01-01#
Maximum value: #3000-12-31#
Time
#00\:00\:00#
#12\:20\:56#
Minimum value: #00\:00\:00#
Maximum value: #23\:59\:59#
Date Time
#1900-01-01 00:00:00#
#1988-08-28 23:59:59#
Minimum value: #1900-01-01 00:00:00#
Maximum value: #3000-12-31 23:59:59#

Hi,

When I am looking in the DB (with oracle or check the data in SS) for that table, i am able to see that the attribute from the records is "1" (which is an ID), I change it in OS to another one and publish the module, i check that in Oracle and it`s changed (let`s say that is "2" now). 

Then I will delete that attribute from the record (it is empty now), and I publish the module. I check again with Oracle directly in the DB, and the attribute now is still 2, and in OS i have nothing assigned to that attribute from that record. 

Hi Stefan,

Since the Static Entity editor is a little quirky, did you close the pop-up after removing the value? And if so, did you reopen it to see if it's really gone?

Also, if it's really gone, after you publish and you look in the database, there's still an Id there?

And a last question: is the Attribute set to Mandatory? (If it is, and you can publish after removing it, it's a bug, but I want to make sure.)

Hi Kilian,

I don`t have that pop-up for editing the values. :) And I have checked again and we don`t have a value assigned to that attribute. 

I have also looked into the DB and i still have a value there (the last one that was assigned).

That Attribute is not a Mandatory one.


Thanks.

Hello Stefan,

Let me ask something just to take out a possible misunderstanding from my part...

When you say you are deleting the attribute, you are saying that you are deleting the value assigned to the attribute?

Just to be sure you are not deleting the attribute itself (don't seem to be the case), as the field in the database would still be there.

Did you tried to assign a NullIdentifier() as the value, instead of leaving empty?

Cheers.

Hi Eduardo,

Indeed, I am deleting the value of that attribute, the attribute is still there.

Yes, but it does not let me to assign that value (NullIdentifier()), to that attribute. 

And when I see that i don`t have a value assigned to that attribute I presume it`s a NULL one, don`t really expect to assign the NullIdentifier(). 

But as I said before, on the other environment, where we deployed, the data in DB is correct, on those records we have a NULL value for that attribute.

Br,

Stefan


Solution

Hi Stefan,

I can reproduce the problem, and I think I know what is happening.

After setting a value for a record, the Service Studio do not change the value unless you set a NEW VALID identifier of the other entity.

If you just clear or put something that is not in the format Entities.YourStaticEntity.RecordName, the Service Studio ignores the change and keeps the value that is there.

It seems to e a bug in Service Studio, not a feature.

Cheers.

Solution

That`s it!

Thanks Eduardo.

How should I proceed with this? Maybe inform the people from OS to be aware of this.


Br, 

Stefan

Already informed. :)

Hope this will be fixed in a next release. For now, only workaround seems to be delete the whole record and recreate it.

Or if you have access to the database, change directly (but don't).

Cheers

Thanks again, Eduardo.

Cheers