My Requirement is to update a domain object's id (string value) from an external source just before 'Save'. I have a BaseDao class which uses saveOrUpdate(Domain object).
Im planning to use Interceptors for this purpose, I configured an interceptor in my Spring's Hibernate and overrridden onSave. After this call my BaseDao would call saveOrUpdate(domainObject)
I would like the grid id to my domain object and all its association objects
recursively
Code:
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="entityInterceptor">
<bean class="xxx.utils.GridIdentifierInterceptor" autowire="byType"/>
</property>
......
</bean>
<bean id="gridIdentifierCreator" class="xxx.utils.CaBigGridIdentifierCreator"/>
Code:
public class MyInterceptor extends EmptyInterceptor {
private GridIdentifierCreator gridIdentifierCreator;
public boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) {
boolean localMod = false;
DomainObject domainObject = (DomainObject) entity;
String bigId = gridIdentifierCreator.getGridIdentifier(domainObject.getId().toString());
domainObject.setGridId(bigid);
return true;
}
}
After running, I can step through my debugger and I see that my interceptopr is called for all my association objects as well. However after all the objects are intercepted, the code just hangs with the below log message. My jsp just hangs. I dont know I have to overrid other methods for this interceptor and where things are going wrong.
Can anyone suggest what I should do?
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
3.2.1
Mapping documents:
annotated classes
Code between sessionFactory.openSession() and session.close():
I use Spring's HibernateUtil
Full stack trace of any exception that occurs:
2007-01-20 17:23:08,468 DEBUG [org.hibernate.jdbc.AbstractBatcher] - Executing batch size: 1
Name and version of the database you are using:
Oracle 9i