Hi All,
I am trying to save data using session.saveOrUpdate(obj). Here obj is a bean object and is returned by calling a method from a class that is in another jar. The bean class is also defined in this jar file.
For e.g in below Market.hbm.xml file, the Market bean is in the jar file and the package points to the jar. In MktPersistance.java, the below error is thrown at saveOrUpdate(). Looks like Market class is not being identified since its in the jar file. Also, the values in obj object are displaying correctly logger.info("\nEntity to be persisted=" + obj).
14:37:01.345 [pool-1-thread-1] ERROR c.a.f.n.o.s.support.MktPersistence - Unknown entity: com.pnd.data.MarketPlease let me know how this can be resolved. Thanks a lot for your time.
Code:
1. Market.hbm.xml
2. <hibernate-mapping package="com.pnd.data.Market">
3. <class name="Market" table="MRKT">
4.
5.
6. MktPersistance.java
7. // data is a Set of Market bean objects.
8. for (Object obj : data) {
9. try {
10. session = HibernateUtil.getSessionFactory().getCurrentSession();
11. session.beginTransaction();
12. logger.info("\nEntity to be persisted=" + obj);
13. logger.info("class = "+obj.getClass());
14.
15. session.saveOrUpdate(obj);
16. logger.info("\nAfter Save or Update");
17.
18. session.flush();
19. session.clear();
20. logger.info("session clear done");
21. session.getTransaction().commit();
22. }
23. catch(RuntimeException ex){
24. .....
25. }
26. }
Thanks a lot in advance..