I was using Objectify 3 and spring before. Now i am trying to shift from Objectify3 to Objectify4. I read best practices of Objectify3 and used DAOBase in the below way.
public class DAO<T extends BaseEntity> extends DAOBase{
static {
ObjectifyService.register(MyEntity);
}
//all the common methods like save, getById, delete, upate...
}
@Repository
public class DAOMyEntity extends DAO<MyEntity>{
//specific methods to MyEntity like getByMyEntityEmail....
}
And i can autowire DAOMyEntity in all my controllers.
As Objectify4 doesn’t have DAOBase, can you please suggest the best way i can do this with Objectify4? Do you think writing DAOBase myself would be better?
Thanks,
Ramesh.V
see https://github.com/stickfigure/motomapia/commits/15975ee0918dd5d7ecc25361eb66b377ce83c2d9/src/main/java/com/motomapia/Ofy.java for a couple ways to do it …
I haven’t made the jump yet but that is the way I’ll go when I do…