When running the debugger this is what I found:
/**Adds a new <code>LanguageFilter</code> to this <code>TranslatorFilter</code>. If a <code>LanguageFilter</code>
* is already registered with the same language then it is overritten in favor of the new <code>LanguageFilter</code>*/
public void addLanguageFilter(LanguageFilter filter)
{
if(getLanguageFilter(filter.getLanguage()) != null) //if we already have a LanguageFilter for the specified language
{
int index = selectedLanguageFilters.indexOf(getLanguageFilter(filter.getLanguage()));
selectedLanguageFilters.add(index,filter); //GAVIN This is where the program stops
filter.setIndex(index);
}
else
{
selectedLanguageFilters.add(filter);
reOrder();
}
filter.setFilter(this);
}
Here is the stack trace.
addLanguageFilter():171, com.atwoodsoft.tools.translator.TranslatorFilter
setSelectedLanguageFilters():103, com.atwoodsoft.tools.translator.TranslatorFilter
setPropertyValues(), com.atwoodsoft.tools.translator.TranslatorFilterMetaClass0
setPropertyValues():158, net.sf.hibernate.persister.AbstractEntityPersister
doSave():724, net.sf.hibernate.impl.SessionImpl
save():620, net.sf.hibernate.impl.SessionImpl
saveOrUpdate():1214, net.sf.hibernate.impl.SessionImpl
From this stack trace I am guesing that Hibernate saves my data succesfully to the database and then, within the same transaction, tries to reload the object being saved. The problem seems to be caused when hibernate tries to set the languageFilter's property. This is probably because the setSelectedLanguageFilters method implements logic to ensure that the order of LanguageFilters in the list is corrospondent to their index property. I am wondering why does hibernate try to repopulate an object that has just been saved?
Thanks,
John
|