Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
3.2.5.ga
Mapping documents:
e.g.:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping
package="org.pcd.wam.gegenstandsbereich.tmcHibernate.model.web">
<class name="PersonalName" table="PERSONAL_NAME">
<!-- primary key -->
<id name="id" type="integer" column="PN_ID">
<generator class="increment" />
</id>
<property name="forename" type="string" column="PN_FORENAME" />
<property name="surname" type="string" column="PN_SURNAME" />
</class>
</hibernate-mapping>
Full stack trace of any exception that occurs:Name and version of the database you are using:Oracle XE
Hi!
I have 2 Projects (Project A and Project B).
Project A only contains hibernate hbm files and java classes for that hbm files.
Project B needs Project A to communicate with the database. For that, Project B contains a hibernate.cfg.xml which should include all hbm files from Project A.
Project A exist at the classpath from Project B
+) How I can do this?
-) Project A contains hibernate hbm and java classes for that on:
Code:
org.pcd.wam.gegenstandsbereich.tmcHibernate.model.event
org.pcd.wam.gegenstandsbereich.tmcHibernate.model.locating
org.pcd.wam.gegenstandsbereich.tmcHibernate.model.statistic
org.pcd.wam.gegenstandsbereich.tmcHibernate.model.web
I tried following:
Code:
<mapping jar="lib/ProjectA-1.0-SNAPSHOT.jar"
resource="org.pcd.wam.gegenstandsbereich.tmcHibernate.model.web.PersonalName" />
Exception:
Code:
Exception in thread "main" org.hibernate.MappingNotFoundException: resource: org.pcd.wam.gegenstandsbereich.tmcHibernate.model.web.PersonalName not found
at org.hibernate.cfg.Configuration.addResource(Configuration.java:563)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1587)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1555)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1534)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1508)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1428)
at org.pcd.wam.gegenstandsbereich.tmcHibernate.HibernateUtil.getSessionFactory(HibernateUtil.java:65)
at org.pcd.wam.gegenstandsbereich.tmcHibernate.HibernateUtil.getCurrentSession(HibernateUtil.java:78)
at at.pcd.wam.gegenstandsbereich.tmcWeb.common.FillTestDate.main(FillTestDate.java:16)
or:
Code:
<mapping jar="lib/ProjectA-1.0-SNAPSHOT.jar" />
Exception:
Code:
Exception in thread "main" org.pcd.wam.gegenstandsbereich.tmcHibernate.dao.exception.DAOException: exception occurred while loading driver:
at at.pcd.wam.gegenstandsbereich.tmcWeb.common.FillTestDate.main(FillTestDate.java:33)
Caused by: org.hibernate.MappingException: Unknown entity: org.pcd.wam.gegenstandsbereich.tmcHibernate.model.web.PersonalName
at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:550)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:68)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)
at org.hibernate.impl.SessionImpl.load(SessionImpl.java:795)
at org.hibernate.impl.SessionImpl.load(SessionImpl.java:788)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:301)
at $Proxy0.load(Unknown Source)
at org.pcd.wam.gegenstandsbereich.tmcHibernate.dao.GenericHibernateDAO.findById(GenericHibernateDAO.java:71)
at at.pcd.wam.gegenstandsbereich.tmcWeb.common.FillTestDate.main(FillTestDate.java:27)
ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2
JDWP exit error AGENT_ERROR_NO_JNI_ENV(183): [../../../src/share/back/util.c:820]