2219 words

Issue #282 - ObjectDB-2.6.9: Failed to commit transaction: Failed to set numeric value of field property Element.id using reflection

BugVersion: Priority: HighStatus: FixedReplies: 9
#1
2016-08-15 13:37

The following error is reported for objectdb-2.6.9.jar:

Failed to commit transaction: Failed to set numeric value of field property com.greensoft.objectdb.test.entity.Element.id using reflection (error 613)

Did not happen with objectdb-2.6.3_04 (which one can easily test and compare in the test console app for NetBeans8.1 provided, as explained below).

To reproduce download the app and unpack, open in NetBeans8.1, perform Clean and Build, and Run:

https://www.webel.com.au/downloads/objectdb/GreensoftObjectdbTestNoweb.2016-08-15.GS4230.tgz

com.greensoft.objectdb.test.console.Main.

There is an Ant script with post-compile enhancement of all entity classes. When you clean and build it will report:

Java/JVM version: 1.8
Java/JVM detail version: 1.8.0_74
ObjectDB enhancer: begin: (all classes within entity packages):
javac.classpath:lib/objectdb-2.6.9.jar
[ObjectDB 2.6.9 Enhancer]
8 persistable types have been enhanced:
    com.greensoft.objectdb.test.entity.Constraint
    com.greensoft.objectdb.test.entity.Element
    com.greensoft.objectdb.test.entity.Link
    com.greensoft.objectdb.test.entity.Permissions
    com.greensoft.objectdb.test.entity.Project
    com.greensoft.objectdb.test.entity.Source
    com.greensoft.objectdb.test.entity.Tag
    com.greensoft.objectdb.test.entity.TagSet
1 NON persistable type has been enhanced:
    com.greensoft.objectdb.test.entity.Role

ObjectDB enhancer: end: (all classes within entity packages):

The entity model is built and persisted in Main in protected void createProject(EntityManagerFactory emf):

protected void createProject(EntityManagerFactory emf) {
 
        format().outHeader2("Create Project and Element model ...");
        Project project = new Project(null, "project"); //NB: Project has no project and no owner
 
        Element model = new Element(project, project, "model");//NB: model has Project as owner       
        project.addOwnedElement(model);
 
        Element example = new Element(model, project, "example element");
        example.setHelp("Note owner of this is a model Element");
        model.addOwnedElement(example);
...

 

        EntityManager em = emf.createEntityManager();
        format().out("Persist project..");
        em.getTransaction().begin();
        em.persist(project); //rely on Cascade all on ownedElements.
       em.getTransaction().commit();
 
       ...

On attempting to persist it get error:

  Create EntityManagerFactory ..
 
****** Create Project and Element model ... ******
 
Persist project..
 
Exception in thread "main" [ObjectDB 2.6.9] javax.persistence.RollbackException
Failed to commit transaction: Failed to set numeric value of field property com.greensoft.objectdb.test.entity.Element.id using reflection (error 613)
at com.objectdb.jpa.EMImpl.commit(EMImpl.java:290)
at com.greensoft.objectdb.test.console.Main.createProject(Main.java:86)
at com.greensoft.objectdb.test.console.Main.run(Main.java:198)
at com.greensoft.objectdb.test.console.Main.main(Main.java:223)
Caused by: javax.persistence.PersistenceException: com.objectdb.o.UserException: Failed to set numeric value of field property com.greensoft.objectdb.test.entity.Element.id using reflection
at com.objectdb.o._PersistenceException.b(_PersistenceException.java:47)
at com.objectdb.o.JPE.g(JPE.java:145)
at com.objectdb.o.JPE.g(JPE.java:78)
... 6 more
Caused by: com.objectdb.o.UserException: Failed to set numeric value of field property com.greensoft.objectdb.test.entity.Element.id using reflection
at com.objectdb.o.MSG.d(MSG.java:75)
at com.objectdb.o.UMR.P(UMR.java:936)
at com.objectdb.o.UMR.I(UMR.java:766)
at com.objectdb.o.VGN.e(VGN.java:76)
at com.objectdb.o.MMM.Q(MMM.java:710)
at com.objectdb.o.MMM.P(MMM.java:697)
at com.objectdb.o.ENH.f(ENH.java:361)
at com.objectdb.o.ENH.f(ENH.java:337)
at com.objectdb.o.STM.E(STM.java:422)
at com.objectdb.o.OBM.bP(OBM.java:931)
at com.objectdb.jdo.PMImpl.bP(PMImpl.java:2279)
at com.objectdb.o.OBM.bO(OBM.java:842)
at com.objectdb.o.OBM.bM(OBM.java:751)
at com.objectdb.jpa.EMImpl.commit(EMImpl.java:287)
... 3 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.objectdb.o.UMR$ac.E(UMR.java:1402)
at com.objectdb.o.UMR$S.J(UMR.java:1025)
at com.objectdb.o.UMR.I(UMR.java:763)
... 14 more
Caused by: com.objectdb.o._IllegalArgumentException: Attempt to modify a primary key of a managed object: com.greensoft.objectdb.test.entity.Project#null
at com.objectdb.o._IllegalArgumentException.b(_IllegalArgumentException.java:43)
at com.objectdb.o.JPE.g(JPE.java:107)
at com.objectdb.o.ERR.f(ERR.java:56)
at com.objectdb.o.OBC.onObjectDBError(OBC.java:1556)
at com.objectdb.o.ENT.al(ENT.java:1676)
at com.objectdb.o.ENT.beforeModifyMember(ENT.java:1179)
at com.greensoft.objectdb.test.entity.Element.setId(Element.java:1)
... 21 more

To compare with objectdb-2.6.3_04.jar

Under /lib there are 2 versions:

lib/objectdb-2.6.3_04.jar*
lib/objectdb-2.6.9.jar

In top-level build.xml change this property to use that version during enhancement (use File view mode not Project view mode in NetBeans to find and edit it):

    <property name="objectdbjar" value="./lib/objectdb-2.6.3_04.jar"/>

Then under the project libraries with NetBeans delete the lib/objectdb-2.6.9.jar and add the lib/objectdb-2.6.3_04.jar.

Clean and Build, and it enhances fine, then Run without error.

---

This is high priority for me; the same error (and another one to be reported following) also happens in a number of work projects and only with newer versions higher than objectdb-2.6.3_04.jar (although I have not done thorough bracketing of this one yet to find out which version introduced it.

If it is an error in my own entity model coding, then it is one that has only expressed itself in recent ObjectDB versions.

It prevents any attempt on my part to upgrade ObjectDB to avoid other errors (and to benefit from other fixes you have performed).

 

 

--- Webel IT Australia, "The Elements of the Web", Specialists in model-based UML, SysML, Enterprise Java, XML, and Drupal CMS web engineering. Dr Darren Kelly, BSc, PhD, https://www.webel.com.au
webel
webel's picture
Joined on 2011-05-27
User Post #86
#2
2016-08-15 15:47

I appreciate that you usually prefer console test apps to web apps, but this one is truly minimal, and for completeness you'll see a very similar error (in NetBeans8.1 if you have the Glassfish log window showing) with this:

https://www.webel.com.au/downloads/objectdb/GreensoftObjectdbTestWebMini.2016-08-16.GS4223.tgz

Unpack, open in NetBeans8.1, and then perform Build.

There is an Ant script with post-compile enhancement of all entity classes. When you clean and build it will report:

Java/JVM version: 1.8
Java/JVM detail version: 1.8.0_74
ObjectDB enhancer: begin: (all classes within entity packages):
javac.classpath:lib/objectdb-2.6.9.jar
[ObjectDB 2.6.9 Enhancer]
3 persistable types have been enhanced:
    com.greensoft.objectdb.test.mini.entity.Element
    com.greensoft.objectdb.test.mini.entity.Project
    com.greensoft.objectdb.test.mini.entity.Source

ObjectDB enhancer: end: (all classes within entity packages):

The entity model is built and persisted in:

package com.greensoft.objectdb.test.mini.ejb;
 
import com.greensoft.objectdb.test.mini.entity.Source;
import com.greensoft.objectdb.test.mini.entity.Project;
import com.greensoft.objectdb.test.mini.entity.Element;
...
 
@Singleton
@Startup
public class ConfigBean extends All_ {
 
    @EJB
    private Builder builder;
 
    @PostConstruct
    public void createData() { ...

On running (with objectdb-2.6.9 and other recent versions) I get this error:

Info:   ConfigBean []: ConfigBean:@PostConstruct:createData
Info:   ConfigBean []: ConfigBean:@PostConstruct:createData: not setting objectdb.temp.no-detach !
Info:   Builder []: Created: com.greensoft.objectdb.test.mini.entity.Project [null](project)
Severe:   Failed to set numeric value of field property com.greensoft.objectdb.test.mini.entity.Element.id using reflection
Severe:   [ObjectDB 2.6.9] javax.persistence.PersistenceException
Failed to set numeric value of field property com.greensoft.objectdb.test.mini.entity.Element.id using reflection (error 363)
at com.sun.enterprise.container.common.impl.EntityManagerWrapper.flush(EntityManagerWrapper.java:437)
at com.greensoft.objectdb.test.mini.ejb.BuilderCommon.persist(BuilderCommon.java:50)
at com.greensoft.objectdb.test.mini.ejb.BuilderCommon.persistElement(BuilderCommon.java:63)
at com.greensoft.objectdb.test.mini.ejb.Builder.createProject(Builder.java:59)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1081)
at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1153)
at com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:4786)
at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:656)
at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:822)
at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:608)
at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:64)
at org.jboss.weld.ejb.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:52)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:883)
at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:822)
at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:608)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doCall(SystemInterceptorProxy.java:163)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundInvoke(SystemInterceptorProxy.java:140)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:883)
at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:822)
at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:369)
at com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:4758)
at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:4746)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:212)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:88)
at com.sun.proxy.$Proxy193.createProject(Unknown Source)
at com.greensoft.objectdb.test.mini.ejb.__EJB31_Generated__Builder__Intf____Bean__.createProject(Unknown Source)
at com.greensoft.objectdb.test.mini.ejb.ConfigBean.project(ConfigBean.java:76)
at com.greensoft.objectdb.test.mini.ejb.ConfigBean.createData(ConfigBean.java:47)

...

at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.objectdb.o.UserException: Failed to set numeric value of field property com.greensoft.objectdb.test.mini.entity.Element.id using reflection
at com.objectdb.o.MSG.d(MSG.java:75)
at com.objectdb.o.UMR.P(UMR.java:936)
at com.objectdb.o.UMR.I(UMR.java:766)
at com.objectdb.o.VGN.e(VGN.java:76)
at com.objectdb.o.MMM.Q(MMM.java:710)
at com.objectdb.o.MMM.P(MMM.java:697)
at com.objectdb.o.ENH.f(ENH.java:361)
at com.objectdb.o.ENH.f(ENH.java:337)
at com.objectdb.o.STM.E(STM.java:422)
at com.objectdb.o.OBM.bP(OBM.java:931)
at com.objectdb.jdo.PMImpl.bP(PMImpl.java:2279)
at com.objectdb.o.OBM.bO(OBM.java:842)
at com.objectdb.o.OBM.flush(OBM.java:772)
... 117 more
Caused by: java.lang.reflect.InvocationTargetException

...

 

 

--- Webel IT Australia, "The Elements of the Web", Specialists in model-based UML, SysML, Enterprise Java, XML, and Drupal CMS web engineering. Dr Darren Kelly, BSc, PhD, https://www.webel.com.au
webel
webel's picture
Joined on 2011-05-27
User Post #89
#3
2016-08-15 15:54

With that same mini test web app:

https://www.webel.com.au/downloads/objectdb/GreensoftObjectdbTestWebMini.2016-08-16.GS4223.tgz

if I set experimental 'objectdb.temp.no-detach' true on startup, I get INSTEAD (or maybe first) the error reported at:

http://www.objectdb.com/database/forum/950

"Enhancement of type com.greensoft ... .entity.Element is old and cannot be used"

But my setup and the cause seem to me to be quite different from the original reporter (btc_es 2015-06-08).

 

--- Webel IT Australia, "The Elements of the Web", Specialists in model-based UML, SysML, Enterprise Java, XML, and Drupal CMS web engineering. Dr Darren Kelly, BSc, PhD, https://www.webel.com.au
webel
webel's picture
Joined on 2011-05-27
User Post #90
#4
2016-08-15 22:04

The console test application (#1) demonstrates critical bugs in ObjectDB when using property access mode (most ObjectDB users use field access mode and are not affected).

  1. A critical Enhancer bug in handling parameterized type properties (e.g. List<Project>). Due to erasure of the type parameters (when the Enhancer hides the original property methods and replace them with new wrapper methods), entity classes seem to be different at runtime and an "Enhancement ... is old" error appears. That makes enhancement almost unusable when property access mode is used.
  2. When an entity class with property access is enhanced but reflection is used (e.g. due to the first bug), the wrapper property is used instead of the original method, and then irrelevant checks are performed by ObjectDB. For example when setting a generated primary key value an "Attempt to modify a primary key" exception is thrown due to a check that was not expected to be performed for a direct access by ObjectDB.

Both of these bugs are not new. Apparently they are here since the first release of ObjectDB 2.x, and strangely have not been reported till now. Maybe they were somehow hidden until some recent change (after 2.6.3_04). In addition, as noted above, most ObjectDB users do not use property access so are not affected.

Build 2.6.9_01 should fix these issues. Thank you for this report. This work is based only on your first post in this thread. If #2 and #3 are still relevant with 2.6.9_01 please let us know.

 

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #2,598
#5
2016-08-16 13:53

Thanks for the Build 2.6.9_01 fix attempt. I have tested it exhaustively. Both of the test applications I provided here above (console app in #1, and mini web app in #2 & #3) work now correctly with Build 2.6.9_01.

But, in my real-world web application it gets further then it still fails with a family of generic value-wrapper entity classes. It is going to take me some time to bundle these into a test case and upload it (as these value-wrapper entity classes are more complex than the entities in the test apps I provided). However, I provide their class signatures in case it is enough for you to diagnose the problem in the meantime.

The basic value-wrapper entity types involved in the error (see below) are:

@Entity abstract public class Value<T> extends Parsel implements IValue<T> {
 
@Entity public class BooleanValue extends Value<Boolean> implements IBooleanValue {
 
@Entity public class IntegerValue extends Value<Integer> ... {
 
@Entity abstract public class Quantity<T extends Number> extends Value<T> implements IQuantity<T> {
 
@Entity public class FloatQuantity extends Quantity<Float> implements IFloatQuantity {
 
@Entity public class IntegerQuantity extends Quantity<Integer> implements IIntegerQuantity {
 
@Entity public class StringValue extends Value<String> implements IStringValue {
 
@Entity public class EnumValue<T extends Enum<T>> extends Value<T> implements IEnumValue<T> {

(There are also many other more specific quantity wrapper sub-types that extend these.)

 

For now I will provide a filtered, edited version of the errors:

....

Enhancement of type com.greensoft.entity.value.BooleanValue is old and cannot be used (6100491157516175398:7605639074554134295)
Severe: [2016-08-17 09:27:21 #62 type.user]
Enhancement of type com.greensoft.entity.value.BooleanValue is old and cannot be used (6100491157516175398:7605639074554134295)
Info: [2016-08-17 09:27:21 #63 type]
Type com.greensoft.entity.value.BooleanValue is not enhanced.
Severe: [2016-08-17 09:27:21 #63 type]
Type com.greensoft.entity.value.BooleanValue is not enhanced.
...

Enhancement of type com.greensoft.entity.value.FloatQuantity is old and cannot be used (-7823612824339348927:-8693897004991762045)
Severe: [2016-08-17 09:27:22 #951 type.user]
Enhancement of type com.greensoft.entity.value.FloatQuantity is old and cannot be used (-7823612824339348927:-8693897004991762045)
Severe: [2016-08-17 09:27:22 #952 type]
Type com.greensoft.entity.value.FloatQuantity is not enhanced.
Info: [2016-08-17 09:27:22 #952 type]
Type com.greensoft.entity.value.FloatQuantity is not enhanced.

...

Enhancement of type com.greensoft.entity.value.IntegerQuantity is old and cannot be used (-1605599394149963286:7575578562632578734)
Severe: [2016-08-17 09:27:22 #954 type.user]
Enhancement of type com.greensoft.entity.value.IntegerQuantity is old and cannot be used (-1605599394149963286:7575578562632578734)
Info: [2016-08-17 09:27:22 #955 type]
Type com.greensoft.entity.value.IntegerQuantity is not enhanced.
Severe: [2016-08-17 09:27:22 #955 type]
Type com.greensoft.entity.value.IntegerQuantity is not enhanced.

...

Type com.greensoft.greenstar.entity.quantity.maths.NaturalNumber is not enhanced.
Severe: [2016-08-17 09:27:22 #956 type]
Type com.greensoft.greenstar.entity.quantity.maths.NaturalNumber is not enhanced.

[AND MANY OTHER DERIVED VALUE WRAPPER TYPES]

...

Enhancement of type com.greensoft.entity.value.StringValue is old and cannot be used (3954904130326593391:-6919608498684727566)
Severe: [2016-08-17 09:27:22 #995 type.user]
Enhancement of type com.greensoft.entity.value.StringValue is old and cannot be used (3954904130326593391:-6919608498684727566)

....

Enhancement of type com.greensoft.entity.value.EnumValue is old and cannot be used (-3022312519886719833:2188305773183813093)
Severe: [2016-08-17 09:27:22 #1050 type.user]
Enhancement of type com.greensoft.entity.value.EnumValue is old and cannot be used (-3022312519886719833:2188305773183813093)
Severe: [2016-08-17 09:27:22 #1051 type]
Type com.greensoft.entity.value.EnumValue is not enhanced.
Info: [2016-08-17 09:27:22 #1051 type]
Type com.greensoft.entity.value.EnumValue is not enhanced.

....

 

Which eventually leads to this error:

 

Caused by: javax.ejb.CreateException: Initialization failed for Singleton ReflectionHelper
at com.sun.ejb.containers.AbstractSingletonContainer.createSingletonEJB(AbstractSingletonContainer.java:476)
at com.sun.ejb.containers.AbstractSingletonContainer.access$000(AbstractSingletonContainer.java:74)
at com.sun.ejb.containers.AbstractSingletonContainer$SingletonContextFactory.create(AbstractSingletonContainer.java:647)
... 47 more
Caused by: com.objectdb.o.UserException: Failed to locate set method for field property com.greensoft.entity.value.EnumValue.oldValue using reflection
at com.objectdb.o.MSG.d(MSG.java:75)
at com.objectdb.o.UMR.P(UMR.java:937)
at com.objectdb.o.UMR$ac.i(UMR.java:1382)
at com.objectdb.o.MMM.<init>(MMM.java:299)
at com.objectdb.o.UTY.W(UTY.java:619)
at com.objectdb.o.TYS.y(TYS.java:787)
at com.objectdb.o.TYS.x(TYS.java:639)
at com.objectdb.o.TYS.v(TYS.java:591)
at com.objectdb.o.TYM.ae(TYM.java:549)
at com.objectdb.o.TYM.ad(TYM.java:497)
at com.objectdb.jpa.MetamodelImpl.prepareTypeLists(MetamodelImpl.java:230)
at com.objectdb.jpa.MetamodelImpl.getEntities(MetamodelImpl.java:114)
at com.greensoft.ejb.ReflectionHelper.entityName2class(ReflectionHelper.java:105)
at com.greensoft.ejb.ReflectionHelper.init(ReflectionHelper.java:83)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.ejb.containers.interceptors.BeanCallbackInterceptor.intercept(InterceptorManager.java:1035)
at com.sun.ejb.containers.interceptors.CallbackChainImpl.invokeNext(CallbackChainImpl.java:72)
at com.sun.ejb.containers.interceptors.CallbackInvocationContext.proceed(CallbackInvocationContext.java:205)
at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:55)
at org.jboss.weld.ejb.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:52)
at sun.reflect.GeneratedMethodAccessor73.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.ejb.containers.interceptors.CallbackInterceptor.intercept(InterceptorManager.java:986)
at com.sun.ejb.containers.interceptors.CallbackChainImpl.invokeNext(CallbackChainImpl.java:72)
at com.sun.ejb.containers.interceptors.CallbackInvocationContext.proceed(CallbackInvocationContext.java:205)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doCall(SystemInterceptorProxy.java:163)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.init(SystemInterceptorProxy.java:125)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.ejb.containers.interceptors.CallbackInterceptor.intercept(InterceptorManager.java:986)
at com.sun.ejb.containers.interceptors.CallbackChainImpl.invokeNext(CallbackChainImpl.java:72)
at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:412)
at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:375)
at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:2014)
at com.sun.ejb.containers.AbstractSingletonContainer.createSingletonEJB(AbstractSingletonContainer.java:468)
... 49 more
Caused by: java.lang.NoSuchMethodException: com.greensoft.entity.value.EnumValue.setOldValue(java.lang.Object)
at java.lang.Class.getDeclaredMethod(Class.java:2130)
at com.objectdb.o.UMR$ac.i(UMR.java:1368)
... 87 more
--- Webel IT Australia, "The Elements of the Web", Specialists in model-based UML, SysML, Enterprise Java, XML, and Drupal CMS web engineering. Dr Darren Kelly, BSc, PhD, https://www.webel.com.au
webel
webel's picture
Joined on 2011-05-27
User Post #92
#6
2016-08-16 15:02

ObjectDB doesn't support generics in entity type definitions.

You cannot define a generic class as an entity (including abstract) and inheritance of entity classes from generic classes is also not supported. ObjectDB should probably produce a clear error message in that case.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #2,601
#7
2016-08-18 11:28

You wrote:

> ObjectDB doesn't support generics in entity type definitions ..
> You cannot define a generic class as an entity (including abstract) and
> inheritance of entity classes from generic classes is also not supported. 

 

The class signatures I provided worked fine (and have for years before) with ObjectDB with objectdb-2.6.3_04.

You now say this is all unsupported.

This is a major problem for our project; we would have to re-engineer our entire value system and most usages of it throughout a very large web application. The only alternative at the moment is to keep using objectdb-2.6.3_04 indefinitely (and thus not benefit from any other bug fixes).

Please consider whatever you have must have changed since objectdb-2.6.3_04 that has clearly "broken" something that was inadvertently indeed supported, and re-instate it.

You wrote:

> ObjectDB should probably produce a clear error message in that case.

Yes it should, to help save people like me wasting many days on it.

--- Webel IT Australia, "The Elements of the Web", Specialists in model-based UML, SysML, Enterprise Java, XML, and Drupal CMS web engineering. Dr Darren Kelly, BSc, PhD, https://www.webel.com.au
webel
webel's picture
Joined on 2011-05-27
User Post #95
#8
2016-08-19 12:09

Using generic entity classes with ObjectDB may work to some extent. You can use a generics class parameter as the type of a persistent field, but in that case ObjectDB will consider that persistent field type as java.lang.Object.

Build 2.6.9_02 supports an option to disable the "Enhancement ... is old" check and error:

    System.setProperty("objectdb.temp.no-enhancement-crc-check", "true");

Set the property before accessing ObjectDB do disable ObjectDB checks. If all your classes are enhanced properly and the problem is in this check then you may be able to use your application with the last build.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #2,604
#9
2016-08-20 14:21

You wrote:

"Build 2.6.9_02 supports an option to disable the "Enhancement ... is old" check and error:

    System.setProperty("objectdb.temp.no-enhancement-crc-check", "true"); "

I am testing this both with dedicated mini console test apps and with my main web app. I am getting inconsistent results so far. May I ask, is setting this special property supposed to switch off any reports/logging of:

    "Enhancement of type ... is old and cannot be used"

Or is it just supposed to switch off any side-effects of it ?

I am still getting that error message.

[EDIT: solved at http://www.objectdb.com/database/forum/1104]

 

Also, although I am using post-compile, pre-deployment enhancement of all entity classes using and Ant script, I am getting in some cases on running both console test apps and my main web app that various classes are not enhanced (when clearly they are). [EDIT: This was because the NetBeans Run and Ant were over-writing the enhanced classes in the "console" app]

 

Further, I am getting different results (and different ObjectDB log) if I also (in addition to the post-compile enhancement) have run-time javaagent enhancement on. [Edit: removed run-time javaagent enhancement from all further tests.]

    

--- Webel IT Australia, "The Elements of the Web", Specialists in model-based UML, SysML, Enterprise Java, XML, and Drupal CMS web engineering. Dr Darren Kelly, BSc, PhD, https://www.webel.com.au
webel
webel's picture
Joined on 2011-05-27
User Post #99
#10
2016-08-21 09:32

I wrote:

    > I am getting inconsistent results so far. ...

I found out why. Reasons include:

1. The Run context menu option (which invokes Ant) in my NetBeans project was over-writing the post-compile enhanced class files. I switched to only running from the console (see also forum posting below).

Spawned to dedicated forum posting focussing on the generics aspects and with very careful diagnostics: objectdb-2.6.9_02 (with "objectdb.temp.no-enhancement-crc-check") vs. generic classes with interfaces: detailed investigation

 

--- Webel IT Australia, "The Elements of the Web", Specialists in model-based UML, SysML, Enterprise Java, XML, and Drupal CMS web engineering. Dr Darren Kelly, BSc, PhD, https://www.webel.com.au
webel
webel's picture
Joined on 2011-05-27
User Post #102

Post Reply

Please read carefully the posting instructions - before posting to the ObjectDB website.

  • You may have to disable pop up blocking in order to use the toolbar (e.g. in Chrome).
  • Use ctrl + right click to open the browser context menu in the editing area (e.g. for using a browser spell checker).
  • To insert formatted lines (e.g. Java code, stack trace) - select a style in the toolbar and then insert the text in the new created block.
  • Avoid overflow of published source code examples by breaking long lines.
  • You may mark in paragraph code words (e.g. class names) with the code style (can be applied by ctrl + D).
  • Long stack traces (> 50 lines) and complex source examples (> 100 lines) should be posted as attachments.
Attachments:
Maximum file size: 32 MB
Cancel