How does Ebean check if the model has been improved or not?

I have defined a base model that has no fields and am improving it using the Ebean eclipse plugin. Then I use the java decompiler to decompile it, finding that ebean adds some fields and methods to it:

private static String _EBEAN_MARKER = "play.modules.ebean.Model";

protected EntityBeanIntercept _ebean_intercept = new EntityBeanIntercept(this);

protected transient Object _ebean_identity;

public String _ebean_getMarker() {
    return _EBEAN_MARKER;
}

public EntityBeanIntercept _ebean_getIntercept() {
    return this._ebean_intercept;
}

public EntityBeanIntercept _ebean_intercept() {
    if (this._ebean_intercept == null)
        this._ebean_intercept = new EntityBeanIntercept(this);
    return this._ebean_intercept;
}

public void addPropertyChangeListener(PropertyChangeListener listener) {
    this._ebean_intercept.addPropertyChangeListener(listener);
}

public void addPropertyChangeListener(String name, PropertyChangeListener listener) {
    this._ebean_intercept.addPropertyChangeListener(name, listener);
}

public void removePropertyChangeListener(PropertyChangeListener listener) {
    this._ebean_intercept.removePropertyChangeListener(listener);
}

public void removePropertyChangeListener(String name, PropertyChangeListener listener) {
    this._ebean_intercept.removePropertyChangeListener(name, listener);
}

public void _ebean_setEmbeddedLoaded() {}

public boolean _ebean_isEmbeddedNewOrDirty() {
    return false;
}

public Object _ebean_newInstance() {
    return new Model();
}

Then I copied this code to the source Model class, disabled the Ebean enhancer, compiled it using eclipse.

I thought this should have the same effect as Ebean.

Then I packed it as a jar, placed it in my project and defined a model class Articlefor its expansion.

But there is an error:

An unexpected error occured caused by exception PersistenceException:
java.lang.IllegalStateException: Class [class test.Model] is not enhanced 
  and [class models.Article] is - (you can not mix!!)

It seems that Ebean does not treat my new class Modelas extended. I wonder how Ebean checks if a class has been strengthened by this or not.

+3
source share
1

Ebean . - //.

( ) .

+2

All Articles