For example:
@Entity @AutoProperty public abstract class AbstractEntity implements Serializable { @Id @GeneratedValue(strategy=GenerationType.AUTO) private long id; private String s; // Setter, Getters, Constructors, Pojomatic... }
@Entity @AutoProperty public class ConcreteEntity extends AbstractEntity { private String s2; // Setter, Getters, Constructors... }
JPA.INSTANCE.clear(); ConcreteEntity ce = new ConcreteEntity(); ce.setS("AAA"); ce.setS2("BBB"); JPA.INSTANCE.save(ce); JPA.INSTANCE.clear(); ConcreteEntity retr = JPA.INSTANCE.get( ConcreteEntity.class, ce.getId()); System.out.println("Source == Retrieved: " + (ce==retr)); System.out.println(retr);
Source == Retrieved: false ConcreteEntity{id: {1}, s: {AAA}, s2: {BBB}}
No comments:
Post a Comment