0
votes

Sorry For improper question title, i dint get any relevant title for my question.

I started using Objectify-Appengine in a new project, I Would like to hear what would be the better solution to create entities from base entity class, consider base class as,

@Entity
public Class User { ... some properties...}

then i would like to create some other entities like as below,

@EntitySubclass
public class AdminUser extends User {}

@EntitySubclass
public class Staff extends User {}

and important point is, i dont want to persist Base Entity "User", meaning there will not be any person of this type.

is my current solution is good? or is there any better way of doing this?

Any Help or suggestion would be helpful.

Thanks

1

1 Answers

0
votes

I'm no objectify expert here, but it seems wrong to me that you have '@Entity public Class User...' if you aren't going to have an entity of type User.

My impression is that you just want to have 2 entity types (Staff and Admin), and you want some shared Java code in a common base class. So you don't need to use @EntitySubclass at all. So how about:

public Class User { ... some properties...}

@Entity
public class AdminUser extends User {}

@Entity
public class Staff extends User {}