0

Can i do that:

>  public void save(Object obj) {
>           try {
>               getHibernateSession().save(obj);
>           } catch (Exception e) {
>           
>               e.printStackTrace();
>           }
>           
>       }

pass any entity as a parameter, and be sure that it will always be persisted without any problem?

harold
  • 1
  • 1
  • Yes, because the entity manager itself is already a DAO facade so you should not wrap the entity manager in another DAO facade. – Smutje Feb 25 '15 at 09:49

1 Answers1

0

Yes, you can. And if your code (entity hierarchy, for example) will be well, you will be sure that entities will be persisted into database without any problem. The key moment of your question is right classes structure(hierarchy) and right instructions for hibernate through annotations.