This is my persistence.xml file:
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/ ... ce_1_0.xsd"
version="1.0">
<persistence-unit name="shopvisit">
<properties>
<property name="hibernate.ejb.cfgfile" value="/hibernate.cfg.xml" />
</properties>
</persistence-unit>
</persistence>
This is the relevant portfion of my hibernate.cfg.xml:
<mapping resource="shopvisit/PortfolioActiveObject.hbm.xml"/>
<mapping resource="shopvisit/Run.hbm.xml"/>
<mapping resource="shopvisit/RunBatch.hbm.xml"/>
<mapping resource="shopvisit/BatchRunMapping.hbm.xml"/>
</session-factory>
</hibernate-configuration>
This is the error I am getting:
[java] Exception in thread "main" java.lang.IllegalArgumentException: Unknown entity: shopvisit.PortfolioActiveObject
[java] at org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:185)
[java] at shopvisit.PortfolioManagerNew.getRunBatch(Unknown Source)
[java] at shopvisit.PortfolioManagerNew.main(Unknown Source)
[java] Caused by: org.hibernate.MappingException: Unknown entity: shopvisit.PortfolioActiveObject
[java] at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:548)
[java] at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:68)
[java] at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)
[java] at org.hibernate.impl.SessionImpl.get(SessionImpl.java:815)
[java] at org.hibernate.impl.SessionImpl.get(SessionImpl.java:808)
[java] at org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:174)
I have an example working with Hibernate native API + .hbm.xml files using
the same hibernate.cfg.xml file.
Thanks.