Jakob Nielsen
Jakob Nielsen

Reputation: 5198

Dont include Ebeans Variable in SQL Statements

I have an Ebeans Entity class which looks like this:

@Entity
public class User {

    @Id
    private Long userid;
    @Constraints.Required
    private String username;
    private boolean active;
    private String img;
    private String status;
    private int value;
    private int gender; // 0 = female, 1 = male
    private int orientation; // 0 = straight, 1 = gay, 2 = bi

    private int listIndex; // used to store listindex for page references
    private int precessor; // used to link the pages
    private int sucessor;

    private static final int USER_AMOUNT = 50;

    /* FINDER */
    public static Model.Finder<Long,User> find = new Model.Finder<Long, User>(
            Long.class, User.class
    );

the listIndex precessor and sucessor variables are needed in the object, but do not exist in the database. The Finder believes they are, which makes my SQL Statements fail.

So my question is can I somehow tell the Finder NOT to include this three variables in the SQL statments?

Upvotes: 0

Views: 59

Answers (1)

biesior
biesior

Reputation: 55798

Use @Transient annotation on fields you don't want to persist, like

@Transient
private int listIndex;

Upvotes: 2

Related Questions