Convert « Entity « JPA Q&A

1. what is a good pattern for converting between hibernate entities and data transfer objects?

I have had similar questions and concerns as to how to convert between Hibernate entities and data transfer objects to be returned by a web service as are discussed in this ...

2. Convert Hibernate entity to json using JSONArray.fromObject

I am having a problem converting data to json.

Session session = sessionFactory.openSession();       
Affiliate affiliate = (affiliate) session.get( Affiliate , pk );
the debugger showing that the ...

3. Convert a entity from one session to another session

... Criteria criteria = session.createCriteria(Probprod.class).add( Restrictions.eq("bundnr1", bundnr1)).addOrder( Property.forName("enddat").desc()); .... Transaction tx = sessionBuffer.beginTransaction(); sessionBuffer.persist(criteria.list().get(0)); ... tx.commit(); ....