Thanx for the reply. I have tried the method mentioned above as well as implementing Serializable in the 'Attachment' class. It doesn't seem to complain about the mapping being invalid but now the error occurs when Hibernate is trying to get the component. I have attached the extracts of the Java class and Hibernate mapping file.
Java object
Code:
public class Email {
private int emailID;
...
private List attachmentList;
// setters and getters
}
public class Attachment implements Serializable {
private int emailID;
private String fileName;
private Blob fileData;
// setters and getters
// implementation of equals() and hashCode()
}
The Hibernate mapping is as follows:Code:
<class name="com.email.entities.Email" table="EMAIL" lazy="false">
<id name="emailID" type="integer" column="EMAIL_ID" unsaved-value="-1">
<generator class="sequence">
<param name="sequence">EMAIL_ID_SEQ</param>
</generator>
</id>
...
<set name="attachmentList" table="ATTACHMENT" lazy="false">
<key column="EMAIL_ID"/>
<one-to-many class="com.email.entities.Attachment"/>
</set>
</class>
<class name="com.email.entities.Attachment" table="ATTACHMENT" lazy="false">
<composite-id>
<key-property name="newsID" type="integer" column="EMAIL_ID"/>
<key-property name="fileName" type="string" column="FILE_NAME"/>
</composite-id>
<property name="fileData" type="blob" column="FILE_DATA"/>
<class>
Error returnedCode:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory'
defined in ServletContext resource [/WEB-INF/spring-config/dao-config.xml]: Initialization of bean failed;
nested exception is org.hibernate.MappingException: component class not found: com.email.entities.Attachment
org.hibernate.MappingException: component class not found: com.email.entities.Attachment
at org.hibernate.mapping.Component.getComponentClass(Component.java:101)
at org.hibernate.tuple.PojoComponentTuplizer.buildGetter(PojoComponentTuplizer.java:105)
at org.hibernate.tuple.AbstractComponentTuplizer.<init>(AbstractComponentTuplizer.java:40)
...
Caused by: java.lang.ClassNotFoundException: com.email.entities.Attachment
at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:198)
at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:62)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:223)
at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:41)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:140)
at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:108)
at org.hibernate.mapping.Component.getComponentClass(Component.java:98)
... 40 more