Home » Support » Forum » @ElementCollection Set<Integer> is emptied sometimes

@ElementCollection Set<Integer> is emptied sometimes



I'm facing a really strange behavior, which I can't yet reproduce, but it happened 3-4 times already.
ObjectDB seems to clear some fields that are @ElementCollection Set<Integer> of my objects. They appear HashSet<Integer> in ObjectDB Explorer.
The only common thing I've seen is that this MAY happen when schema changes, even though nothing is changed in that Object's class.
Any ideas why would this happen and how could it be avoided?

Thanks (version 2.5.3 & Tomee & NetBeans)


The problem is unclear. What do you mean by clearing some fields? Please clarify.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
The field is emptied, but not null.

So, my @ElementCollection Set<Integer> fields become empty sometimes during development while schema changes, but not all the times. The interesting part is that most of the times, schema changes didn't happen into that class. It's very strange and I can't find yet a way to understand it.

Initially, I was not using @ElementCollection on my Set<Integer> fields from User class. I've seen the behavior a couple of times, then I added @ElementCollection and it seemed to don't happen anymore, until 1 day ago, when some fields got empty again (but not null). (basically...an empty HashSet<Integer>).

I'm still looking into how could I reproduce it.

There is only one place where those fields are manipulated in this project. Just as an idea, I have attached the class that does that, a @Singleton EJB, plus the affected entity.


Please update when you have more information.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

I just want to mention that I didn't forget about this, but the schema of the project I currently work on got into a stable state.

I will try to come with more details when I'll deal with schema changes again.

Thank you.

Post Reply

To post a reply and/or subscribe to update notifications - please login