Hello, Sorry but I am not familiar with Spring yet, so I do not Know if what I am about to tell you could help you.
You want to copy from
com.yourapp.dao.hibernate.PojoOneDaoHibernate (production) to
com.yourapp.dao.test.PojoOneDaoHibernate (test) right.
What I used to do is create SessionFactoryManager class that stores statically (in some static Hashtable property) references to all org.hibernate.SessionFactory builded for my application.
For 2 databases I will need 2 different SessionFactory each one with a different Id, so I can call SessionFactoryManager.getSession(String id).
With this approach you can code something like this
Code:
org.hibernate.Session sessProd =
SessionFactoryManager.getSession"prodId").openSession();
//since SessionFactoryManager hava a Hashtable with SessionFactory
PojoOneDaoHibernate prod = sess.get(......);
com.yourapp.dao.test.PojoOneDaoHibernate test = new PojoOneDaoHibernate ();
PropertyUtils.copyProperties(test, prod );
org.hibernate.Session sessTest =
SessionFactoryManager.getSession"testId").openSession();
sessTest.saveOrUpdate(test);
sessTest.close();
sessProd.close();
That is the idea, well you will need to code it right off course but this should work, as a matter of fact I have used it for copy from one database to another.
Hope it works!!, let me Know