Hibernate version:
2.1.16
Mapping documents:
Code:
<hibernate-mapping auto-import="false">
<class name="foo.Value"
table="VALUE" schema="TEST"
dynamic-update="false"
dynamic-insert="false" >
<id name="id" column="id" type="string" >
<generator class="uuid.hex"/>
</id>
<!-- NONE OF THESE WORKS.
<property name="parent"
type="foo.Value" column="PARENT_ID"/>
<many-to-one name="parent"
type="foo.Value" column="PARENT_ID"/>
<one-to-one name="parent"
type="foo.Value" column="PARENT_ID"/>
-->
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():none
Full stack trace of any exception that occurs: [java] net.sf.hibernate.MappingException: Error reading resource: foo/Value.hbm.xml
[java] at net.sf.hibernate.cfg.Configuration.addClass(Configuration.java:357)
[java] at foo.TestPersistence.testValue(TestPersistence.java:48)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:324)
[java] at junit.framework.TestCase.runTest(TestCase.java:154)
[java] at junit.framework.TestCase.runBare(TestCase.java:127)
[java] at junit.framework.TestResult$1.protect(TestResult.java:106)
[java] at junit.framework.TestResult.runProtected(TestResult.java:124)
[java] .
[java] Time: 0,546
[java] OK (1 test)
[java] at junit.framework.TestResult.run(TestResult.java:109)
[java] at junit.framework.TestCase.run(TestCase.java:118)
[java] at junit.framework.TestSuite.runTest(TestSuite.java:208)
[java] at junit.framework.TestSuite.run(TestSuite.java:203)
[java] at junit.textui.TestRunner.doRun(TestRunner.java:116)
[java] at junit.textui.TestRunner.doRun(TestRunner.java:109)
[java] at junit.textui.TestRunner.run(TestRunner.java:72)
[java] at de.payon.entities.test.TestPersistence.main(TestPersistence.java:111)
[java] Caused by: net.sf.hibernate.MappingException: Could not interpret type: foo.Value
[java] at net.sf.hibernate.cfg.Binder.getTypeFromXML(Binder.java:933)
[java] at net.sf.hibernate.cfg.Binder.bindSimpleValue(Binder.java:434)
[java] at net.sf.hibernate.cfg.Binder.propertiesFromXML(Binder.java:1046)
[java] at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:361)
[java] at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1253)
[java] at net.sf.hibernate.cfg.Configuration.add(Configuration.java:252)
[java] at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:288)
[java] at net.sf.hibernate.cfg.Configuration.addClass(Configuration.java:354)
[java] ... 17 more
Name and version of the database you are using:postgres 7.4
The generated SQL (show_sql=true):none
Debug level Hibernate log excerpt:none
given the following class. how do i define
a mapping file that allows for cyclic
references?
Code:
package foo;
public class Value
{
private String id_;
private Value parent_;
public String getId()
{
return id_;
}
public Value setId(String _value)
{
id_ = _value;
return this;
}
public Value getParent()
{
return parent_;
}
public Value setParent(Value _value)
{
parent_ = _value;
return this;
}
}
when using the following code i get the
exception described above. does anybody
know how to do that correct?
Code:
public void testValue()
{
try
{
Configuration cfg = new Configuration();
InputStream is =
Util.getResource("foo/Value.hbm.xml");
cfg.addInputStream(is);
}
catch (Exception ex)
{
LOGGER.log(Level.SEVERE, "");
ex.printStackTrace();
}
}
thanks
ciao robertj