>> if object is initialized, proxy should be abandoned, right?
No, once a determinate object is initialized as proxy then it will be returned as proxy during the whole persistent context lifetime.
Following scenario explains why:
1.) A a1 = (A) session.load(A.class,id); // loads instance a as prox
2.) System.out.println(a1.getName()) // here the real object is accessed
Peter
3.) A a2 = (A) session.createQuery("from A where name='Peter'").uniqueResult();
If you now expect a2 being de-proxied, then a1 == a2 would be false although referring the same db-record.
This goes in contradiction to what is specified in
http://docs.jboss.org/hibernate/stable/ ... s-identityIn other words:
To maintain the object identity contract within a transaction, Hibernate tries to expose to the
programmer a determinate persistent instance either always as proxy or always as real object,
it depends only from the way how it is accessed for the first time in the transaction.