Bug 86 : field [linkUrl] not found ... when mixing Enhanced and subclassed beans in a single hierachy
Priority 
High
Reported Version 
 
Logged By 
Rob
Status 
Fixed
Fixed Version 
1.1.0
Assigned To 
 
Product 
Ebean - core
Duplicate Of 
 
Created 
06/03/2009
Updated 
06/03/2009
Type 
Bug
 
Attachments 
No attachments

Caused by: javax.persistence.PersistenceException: field [linkUrl] not found in [app.data.MComment][id, cretime, lastUpdate]
at com.avaje.ebean.server.reflect.EnhanceBeanReflect.getFieldIndex(EnhanceBeanReflect.java:69)
at com.avaje.ebean.server.reflect.EnhanceBeanReflect.getGetter(EnhanceBeanReflect.java:73)
at com.avaje.ebean.server.deploy.BeanDescriptorFactory.setBeanReflect(BeanDescriptorFactory.java:901)
at com.avaje.ebean.server.deploy.BeanDescriptorFactory.createByteCode(BeanDescriptorFactory.java:691)
at com.avaje.ebean.server.deploy.BeanDescriptorFactory.createDeployBeanInfo(BeanDescriptorFactory.java:679)
at com.avaje.ebean.server.deploy.BeanDescriptorFactory.createDescriptor(BeanDescriptorFactory.java:263)
at com.avaje.ebean.server.deploy.BeanDescriptorCacheFactory.deployBeanDescriptors(BeanDescriptorCacheFactory.java:229)
at com.avaje.ebean.server.deploy.BeanDescriptorCacheFactory.initialiseAll(BeanDescriptorCacheFactory.java:121)
at com.avaje.ebean.server.deploy.DeploymentManager.(DeploymentManager.java:80)
at com.avaje.ebean.server.plugin.PluginCore.(PluginCore.java:39)
at com.avaje.ebean.server.plugin.PluginFactory.create(PluginFactory.java:85)
at com.avaje.ebean.server.core.DefaultServerFactory.createServer(DefaultServerFactory.java:155)
at com.avaje.ebean.server.core.DefaultServerFactory.createServer(DefaultServerFactory.java:128)
at com.avaje.ebean.server.core.DefaultServerFactory.createServer(DefaultServerFactory.java:1)
at com.avaje.ebean.Ebean$ServerManager.getWithCreate(Ebean.java:225)
at com.avaje.ebean.Ebean$ServerManager.get(Ebean.java:212)
at com.avaje.ebean.Ebean$ServerManager.(Ebean.java:162)
at com.avaje.ebean.Ebean$ServerManager.(Ebean.java:154)
at com.avaje.ebean.Ebean.(Ebean.java:123)
... 1 more

 
Rob 06 Mar 19:25
You can not mix the two...

The issue here is that MComment extends a MappedSuperclass called BaseEnitity

- MComment is not enhanced (it is using subclassing)
- BaseEntity is enhanced

In a single inheritance hierarchy you can not mix enhanced and suclassed beans - they must be all enhanced or all subclassed.

I will make a change so that Ebean checks for this and produces a decent error message.

Rob 12 Mar 08:28
Fixed in HEAD

I have "fixed" this by detecting this situation and generating a more meaningful error.

An example of the Error generated now is:

INFO: No deployment xml (orm.xml etc) was loaded.
Exception in thread "main" javax.persistence.PersistenceException: Error with [app.data.MComment] I believe it is not enhanced but it's superClass [class app.data.BaseEntity] is? (You are not allowed to mix enhancement in a single inheritance hierarchy)
at com.avaje.ebean.server.deploy.BeanDescriptorFactory.setBeanReflect(BeanDescriptorFactory.java:912)
at com.avaje.ebean.server.deploy.BeanDescriptorFactory.createByteCode(BeanDescriptorFactory.java:691)
at com.avaje.ebean.server.deploy.BeanDescriptorFactory.createDeployBeanInfo(BeanDescriptorFactory.java:679)
at com.avaje.ebean.server.deploy.BeanDescriptorFactory.createDescriptor(BeanDescriptorFactory.java:263)
at com.avaje.ebean.server.deploy.BeanDescriptorCacheFactory.deployBeanDescriptors(BeanDescriptorCacheFactory.java:229)
at com.avaje.ebean.server.deploy.BeanDescriptorCacheFactory.initialiseAll(BeanDescriptorCacheFactory.java:121)
at com.avaje.ebean.server.deploy.DeploymentManager.(DeploymentManager.java:80)
at com.avaje.ebean.server.plugin.PluginCore.(PluginCore.java:39)
at com.avaje.ebean.server.plugin.PluginFactory.create(PluginFactory.java:85)
at com.avaje.ebean.server.core.DefaultServerFactory.createServer(DefaultServerFactory.java:155)
at com.avaje.ebean.server.core.DefaultServerFactory.createServer(DefaultServerFactory.java:1)
at com.avaje.ebean.Ebean$ServerManager.register(Ebean.java:190)
at com.avaje.ebean.Ebean$ServerManager.access$2(Ebean.java:176)
at com.avaje.ebean.Ebean.registerServer(Ebean.java:327)
at main.TestServerConfig.main(TestServerConfig.java:40)
Caused by: java.lang.IllegalArgumentException: field [linkUrl] not found in [app.data.MComment][id, cretime, lastUpdate]
at com.avaje.ebean.server.reflect.EnhanceBeanReflect.getFieldIndex(EnhanceBeanReflect.java:69)
at com.avaje.ebean.server.reflect.EnhanceBeanReflect.getGetter(EnhanceBeanReflect.java:73)
at com.avaje.ebean.server.deploy.BeanDescriptorFactory.setBeanReflect(BeanDescriptorFactory.java:902)
... 14 more

Rob 12 Mar 08:29
So hopefully...

People read the:

Error with [app.data.MComment] I believe it is not enhanced but it's superClass [class app.data.BaseEntity] is? (You are not allowed to mix enhancement in a single inheritance hierarchy)

... and it makes sense.

Rob 15 Mar 02:15
Fixed in HEAD

Fixed in HEAD.

woResponse

Upload a file