I have a mapped entity in playOrm which has a lot of attributes, like birthDate, categories, etc.
Suppose I used NoSqlEntityManager.put to save this entity in Cassandra in the first time. I wrote the following:
NoSqlEntityManager em =...;
Entity e = new Entity();
entity.id = 123
entity.birthDate = 20121212
em.put(e);
After that, some time later, I do the following:
NoSqlEntityManager em =...;
Entity e = new Entity();
entity.id = 123
entity.categories = {"cat1", "cat2", "cat3"};
em.put(e);
What will happen in Cassandra? A new entity will be created? Or the old one will be updated (desirable)? If it is updated, will birthDate be erased in my second write? (non-desirable)
em.put(e, false); can be used to update but it reads in a value mostly because it has to figure out if indices have changed/been modified.
If you do em.put(e), then birthDate in the database will be changed to null.
This is interesting though. I wonder if we should have a flag on each field in an entity to say null will not be written to the database like in your case. IF we do have a @Column(nullsWritten=false), the question then becomes if you actually want to write null in a special case, how would you write null in that case? Any ideas?
Do you have any fields with @NoSqlIndexable in the Entity above?
thanks, Dean