I've been trying to use Hibernate to set up ORM for a member class (i.e. a class nested inside another class). But it doesn't seem to work. An example config is shown below. Does anyone know if Hibernate actually supports member classes?
For the class name in the HBM, I've tried using both "com.example.ParentClass$MemberClass" and "com.example.ParentClass.MemberClass".
The first gives class name gives the following exception:
Code:
org.springframework.orm.hibernate3.HibernateSystemException: No default constructor for entity: com.example.ParentClass$MemberClass; nested exception is org.hibernate.InstantiationException: No default constructor for entity: com.example.ParentClass$MemberClass
...
The second gives:
Code:
Invocation of init method failed; nested exception is org.hibernate.MappingException: class com.example.ParentClass.MemberClass not found while looking for property: prop1
Caused by:
...
Am I doing something wrong?
Hibernate version:Hibernate3 (via Spring)
Mapping documents:Code:
<hibernate-mapping auto-import="true" default-lazy="true">
<class name="com.example.ParentClass$MemberClass">
<id name="id" column="id" type="int" />
<property name="prop1" column="prop1" />
</class>
</hibernate-mapping>
[b] Java class
Code:
package com.example;
class ParentClass
{
class MemberClass
{
private int id;
private int prop1;
MemberClass()
{
}
...
}
}
Thanks!