开发者

How do I clearing an index property in a valueObject?

I have used the index of a value object to map to a screen object so that new items added index as -1, -2, -3, -4, -5 etc. Now that I am ready to add these new objects to the database I want to clear their index value so that I can run a createService on them.

It wont allow me to delete object开发者_StackOverflow.property and setting it to 0 or trying to set it to null will not allow the object to be created in the database.

What other method can I use for clearing the property?


First of all, Problem statement is not good enough.Still let me try to answer it(as per my understanding). I suspect you are trying to add it to database table where index property is set to autoIncrement. If it is so, why do you need to set index such as -1,-2,-3 etc. Simply maintain a collection of your objects without giving them any index. Anyway, new Item will only be added at the end of the collection, so you can be sure about the index sequencing.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜