Comments (5)
Changed a few things in Root
...
@Table(Store.class)
private final Lazy<List<Store>> stores = Lazy.Reference(new ArrayList<>(32));
...
/**
* This gets the lazy field by the provided class
* @param c
* @return
* @param <T>
*/
public <T extends SuperDao> Lazy<List<T>> getLazyByClass(Class<? extends SuperDao> c) {
if (c != null) {
for (Field field : Root.class.getDeclaredFields()) {
if (field.isAnnotationPresent(Table.class)) {
Table annotation = field.getAnnotation(Table.class);
if(annotation.value().equals(c)) {
try {
return (Lazy<List<T>>) field.get(this);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}
}
}
}
return null;
}
However I notice 3 things. The load method is never called because the Object ID is 0 each time.
from store.
Hello,
As I can’t run your code, I can give you some hints only.
- By default, we use a lazy storing strategy, this means that a store will stop traversing references as soon as an already stored object reference is encountered. Please see https://docs.eclipsestore.io/manual/storage/storing-data/lazy-eager-full.html.
- Always call the store on the modified objects.
- During development It may be easier to delete the storage files to enforce creating a new storage then updating and storing all modified objects.
Regarding the empty Lazy-Reference I guess that you stored a version that has a null
reference instead of an initialized List. To solve that you need to replace the existing Lazy-Reference with new one referencing an initialized List and then store the Root object. (or simply delete the storage)
Another potential problem I saw is the store in the ‘update’ method. This store stores the Lazy-Reference but will not update the referenced list due to the lazy storing strategy. This will cause new objects added to the list not to be stored. When adding new items to the list you need to store the list and not the Lazy.
from store.
WORKED!
Updated the update method :
public T update(T dao, InterExecutable<T, T> update) {
Root root = (Root) storageManager.root();
List<T> list = root.getListByClass(typeParameterClass);
if (StringUtils.isNotBlank(dao.getUuId())) {
T daoExist = get(dao.getUuId());
if (update != null && daoExist != null) {
update.build(daoExist);// this method is provided to update the existed instance
daoExist.setUuId(dao.getUuId());// to prevent people from overriding the UUID
} else {
return null;
}
} else {
dao.setUuId(UUID.randomUUID().toString());// if new we will add to the list
list.add(dao);
}
List listByClass = root.getListByClass(typeParameterClass);
storageManager.store(listByClass);
return get(dao.getUuId());
}
and created a new storage path.
- No Storing Lazy Object only store the Lazy parameters
- I think the main take away from this is to call the storeRoot() method if you make changes to the root object.
from store.
Can be this Issue closed?
from store.
Yes thank you
from store.
Related Issues (20)
- Handling checked exceptions HOT 1
- IndexOutOfBoundsException when using values().stream() on empty LazyHashMap HOT 1
- Entity and Wrapper code generators in Gradle - please document HOT 3
- Versioning layer exception HOT 4
- --add-exports java.base/jdk.internal.misc=ALL-UNNAMED - please fix the docs!
- Issue with generated layered entity code - may need documentation?
- ES 1.3.1 testing against a Minio (S3-compatible ) storage backend - please help! HOT 2
- Not able to download the GUI client from MAVEN as well as the direct URl HOT 3
- Gcp Cloud storage storage target HOT 1
- java.lang.ClassNotFoundException: sun.misc.Unsafe HOT 2
- Rest Client GUI link is broken HOT 2
- Foundation type handler registration depends on order of api calls
- ObjectCopier class not found HOT 2
- The documentation for the layered entities configuration section is incorrect HOT 1
- Need help with "Error occurred in storage channel" HOT 9
- About Creating Database Issues HOT 1
- About Creating Database Issues HOT 12
- Layered entity generator issue?
- Real "read-only" mode with optimized memory consumption HOT 1
- eclipse store data loading is very very slow when app starts HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from store.