cancel
Showing results for 
Search instead for 
Did you mean: 

How to safely change property type?

irinuca13
Champ in-the-making
Champ in-the-making
Hi everyone!

I have a problem in my Alfresco customization. I created my custom content model and i set a property type to float instead of double. Now Alfresco rounds all the values stored in it. For example i have the value 12521.56 and he shows me 12521.6.

So the solution would be to change the datatype to double, but this would alter all the current values for thousands of documents.

Is there any way to change it safely?

Thanks a lot Smiley Happy

Irina
1 REPLY 1

smicyk
Champ in-the-making
Champ in-the-making
Hi,

some time ago I have similar issue and I solved it in rather no very safe way but it seems to work normally.

The solution is that you should change the property to double in the model, before you run alfresco you must change values in database (you should write sql statements to copy values from float column to double column and change it type in database in alf_properties table). You should also set index.recovery.node to FULL so all lucene indicies are rebuild.

The problem is that you can loose some precision any way, since float can't hold some values which double can.

Anyway you can also try to write some action in java which reads Float from properties and then writes Double to property back, but I didn't check this solution.


Thanks
smicyk