PostUpdate on array changes

#1
Given this config:

<entities>
  <enhancement agent = "true" reflection = "error"/>
  <cache ref = "strong" level2 = "100m"/>
  <fetch hollow = "false"/>
  <persist serialization = "true"/>
  <cascade-persist always = "true" on-persist = "true" on-commit = "true"/>
  <dirty-tracking arrays = "true"/>
</entities>

I'm not  getting PostUpdate changes when a string is added to a list of strings.

All other property changes fire events just fine.

thoughts?

 

 

#2

Note: PostUpdate events are fired if the list contains other Entities !

So, the question is whether it is possible to track changes to lists of primitives?

#3

Hmm, digging into this some more, noticed a couple of things:

a) objectdb.conf file was no longer being found in src/main/resources when run by JUnit in IntelliJ, this had been working fine.

- I now need to explicitly set the config file before any tests with:
System.setProperty("objectdb.home", "<full path to src/main/resources>")

b) So, now that I'm sure that objectdb.conf is found
- The config path as set above is printed to the logs, and 
- I create instances of  > 10 entity classes just to be sure

However, now the system complains:

<pre>
[ObjectDB 2.8.0_04] javax.persistence.PersistenceException
Type au.Person is not enhanced (enhance the type or enable reflection)
 (error 304)
    at com.objectdb.jpa.EMImpl.persist(EMImpl.java:418)
</pre>

This resolves when I change:

<enhancement agent = "true" reflection = "error"/>

to

<enhancement agent = "true" reflection = "force"/>

So, now that I know I have the correct objectdb.conf file I will revisit the issue of dirty tracking of arrays. However, I have these new concerns:

1) why does objectdb no longer pick up objectdb.conf in src/main/resources?

2) why am I now getting an error regarding enhancement - is this because I'm using openjdk version "1.8.0_212"?
- the documents mention openjdk6 doesn't support runtime enhancement, is this still the case??

3) How can I pre-enhance classes when running junit?

4) How can I pre-enhance classes with Gradle?

#4

Can't seem to get array tracking to work.

Given an entity (class A) with property b_list which is a list of other entities (class B)

When an instance of B is added to the b_list of and instance of A

Then I expect a PostUpdate event to be fired for entity A, but no events are fired.

The documentation suggests a 'makeDirty()' method, but this seems only available on JDO.

Question: Is array tracking only available with the JDO api ?

#5

> So, the question is whether it is possible to track changes to lists of primitives?

Yes.

> objectdb.conf file was no longer being found in src/main/resources when run by JUnit in IntelliJ, this had been working fine.

> why does objectdb no longer pick up objectdb.conf in src/main/resources?

See this manual page regarding where objectdb.conf is searched for. Nothing was changed.

> why am I now getting an error regarding enhancement - is this because I'm using openjdk version "1.8.0_212"?
- the documents mention openjdk6 doesn't support runtime enhancement, is this still the case??

It depends how you enhance your classes.

> How can I pre-enhance classes when running junit?

Enhance the classes before your run JUnit, as usual, regardless of JUnit.

> How can I pre-enhance classes with Gradle?

A Maven and an Ant enhancement are shown here. If you convert it to Gradle and it works please post the result.

> Is array tracking only available with the JDO api ?

Yes. Earlier you mentioned lists. Arrays work differently from lists. Is it another issue?

Please use a separate thread for every topic. Since the subject of this thread is "PostUpdate on array changes", any further discussion of any other issue (e.g. enhancement, configuration) requires a separate thread.

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

Post Reply

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