Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(433) : Ebean doesn't honor @Transient for non-primitive array properties #111

Closed
rbygrave opened this issue Apr 29, 2014 · 1 comment
Closed
Labels

Comments

@rbygrave
Copy link
Member

Create a class with a non-primitive array property, e.g. "MyObject[] myObjects" labeled with @transient.
Compile the class and instrument it with Ebean weaver.

At runtime, Ebean fails to load with the following exception:

Caused by: java.lang.IllegalArgumentException: field [myObjects] not found in [com.xxx.MyContainer][id]
at com.avaje.ebeaninternal.server.reflect.EnhanceBeanReflect.getFieldIndex(EnhanceBeanReflect.java:139)
at com.avaje.ebeaninternal.server.reflect.EnhanceBeanReflect.getGetter(EnhanceBeanReflect.java:143)
at com.avaje.ebeaninternal.server.deploy.BeanDescriptorManager.setBeanReflect(BeanDescriptorManager.java:1377)
... 52 more

Workarounds:

  1. Change the property to a List or Set rather than array.
  2. Mark the field with "transient" as well if possible, i.e. if you don't need to use Java serialization on the field.

Fix: Move the "return new DeployBeanPropertyAssocOne(desc, propertyType);" statement inside the "if (!isTransientField(field)){" block in DeployCreateProperties.createProp(), and return null if the field is marked @transient, rather than assuming it is a persistent OneToOne.

rbygrave added a commit that referenced this issue Apr 29, 2014
@rbygrave
Copy link
Member Author

Fixed in 4.0.1-RC2

@rbygrave rbygrave added this to the 4.0.1 milestone Apr 29, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant