Project

General

Profile

Anomalie #8445

Error in generated code for Resource (inherits) without fields

Added by Erwan L. over 4 years ago.

Status:
Nouveau
Priority:
Normal
Assignee:
-
Target version:
Start date:
06/28/2016
Due date:
% Done:

0%

Estimated time:

Description

Create an entity with a field an extends it to EntityResourceBase

/** Photo entity. */
@Entity
@EntityResource
@Table
@InheritanceType(value = SINGLE_TABLE)
@Rest
public class Photo extends EntityResourceBase {
    /** Entity's technical id. */
    @Id
    @Column(type = Column.Type.INTEGER)
    @GeneratedValue(strategy = GeneratedValue.Strategy.MODE_IDENTITY)
    private int id;

    /** Name field. */
    @Column(type = Column.Type.STRING)
    private String name;

    @Override
    public int getId() {
        return this.id;
    }

    @Override
    public void setId(final int value) {
        this.id = value;
    }
}

Create an entity and inherits Photo

@Entity
@Table
@InheritanceType(value = SINGLE_TABLE)
@Rest
public class PhotoUser extends Photo {

}

Launch rest generation and look at PhotoUserWebServiceClientAdapterBase
The code can't compile (try/catch is empty):

    /**
     * Convert a PhotoUser to a JSONObject.
     * @param photoUser The PhotoUser to convert
     * @return The converted PhotoUser
     */
    public JSONObject itemToJson(PhotoUser photoUser) {
        JSONObject params =
                this.motherAdapter.itemToJson(photoUser);
        try {
        } catch (JSONException e) {
            Log.e(TAG, e.getMessage());
        }

        return params;
    }


Recurrences

Also available in: Atom PDF

Go to top
Add picture from clipboard (Maximum size: 200 MB)