Exception in thread "main" java.lang.NoSuchMethodError: app.data.Bug.setFixedVersion(Ljava/lang/String;)V at app.data.Bug$$EntityBean$h2._ebean_createCopy(Bug.java:1) at com.avaje.ebean.bean.EntityBeanIntercept.createOldValues(EntityBeanIntercept.java:271) at com.avaje.ebean.bean.EntityBeanIntercept.preSetter(EntityBeanIntercept.java:372) at app.data.Bug$$EntityBean$h2.setTitle(Bug.java:1) at main.TestTransient.main(TestTransient.java:14)
This bug occurs when:- You use Subclassing (does not occur with Enhanced beans)- You have a transient field that does not have a matching setter method ...
For example:
...@Entity@Table(name = "b_bug")public class Bug {
...
@Transient String fixedVersion;
// and have NO setFixedVersion(String m) method
Test program:
Bug bug = Ebean.find(Bug.class, 1); // change a persistent field... means that Ebean will invoke // the EntityBeanIntercept.createOldValues() method which invokes // _ebean_createCopy() on the underlying entity bean bug.setTitle("modi"); System.out.println("done");
The _ebean_createCopy() is using a setter method on the transient field that does not exist.
Transient fields of course do NOT have to have any setter or getter methods. Ebean does include support for using Transient fields though because they can be useful with raw @SqlSelect.
... but essentially the fix is to not include @Transient fields in the _ebean_createCopy() method.
Fixed in version 1.0.3