store
store copied to clipboard
Issue with generated layered entity code - may need documentation?
Environment Details
- EclipseStore Version: 1.3.1
- JDK version: 21.0.2
- OS: MacOs Sonoma
Describe the bug
This is not really a bug, but rather a suggestion to add documentation.
In a fully modularized application, when the embedded storage manager attempts to persist entities, it fails with:
java.lang.reflect.InaccessibleObjectException: Unable to make protected datamodel.product._Product.ProductEntity() accessible: module datamodel does not "opens datamodel.product._Product" to module org.eclipse.serializer.persistence.binary
at java.base/java.lang.reflect.AccessibleObject.throwInaccessibleObjectException(AccessibleObject.java:391)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:367)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:315)
at java.base/java.lang.reflect.Constructor.checkCanSetAccessible(Constructor.java:194)
at java.base/java.lang.reflect.Constructor.setAccessible(Constructor.java:187)
at [email protected]/org.eclipse.serializer.persistence.binary.org.eclipse.serializer.entity.BinaryHandlerEntityLayerIdentity.WrapDefaultConstructor(BinaryHandlerEntityLayerIdentity.java:61)
at [email protected]/org.eclipse.serializer.persistence.binary.org.eclipse.serializer.entity.BinaryHandlerEntityLayerIdentity.New(BinaryHandlerEntityLayerIdentity.java:50)
at [email protected]/org.eclipse.serializer.persistence.binary.types.BinaryTypeHandlerCreator$Default.createEntityLayerIdentityHandler(BinaryTypeHandlerCreator.java:368)
at [email protected]/org.eclipse.serializer.persistence.binary.types.BinaryTypeHandlerCreator$Default.internalCreateTypeHandlerEntity(BinaryTypeHandlerCreator.java:351)
Additional context
This is fixed by declaring the entity module "open" (also notice that the generated packages like _Product would need to be exported as well):
open module datamodel {
//...
exports datamodel.product._Product;
}