У меня есть абстрактный класс и два подкласса, которые его расширяют. В конфигурационном файле spring
<bean id="importConfigFile" class="xxx.ImportConfigFiles" parent="parentImportFile"></bean>
<bean id="importFile" class="xxx.ImportUMTSKPIFiles" parent="parentImportFile"></bean>
<bean id="parentImportFile" name="parentImportFile" class="xxx.ImportUMTSFiles" abstract="true"></bean>
<tx:annotation-driven transaction-manager="transactionManager" />
у меня есть следующие методы
public void importDataToDB(){
//all the good stuff goes in here
}
@Transactional
public void executeInsertUpdateQuery(){
//all the good stuff goes in here
}
В моем абстрактном классе есть следующие методы
public void importDataToDB(){
//all the good stuff goes in here
}
@Transactional
public void executeInsertUpdateQuery(){
//all the good stuff goes in here
}
Мой java-код
ImportConfigFiles importConfigFiles = (ImportConfigFiles)context.getBean("importConfigFile");
importConfigFiles.setFileLocation(destPath);
importConfigFiles.importDataToDB();
Это не работает. executeInsertUpdateQuery () выполняет только один собственный запрос sql. Если я помещаю @Transactional в imortDataToDB (), он работает, но тогда моя транзакция становится огромной, поскольку внутри этого метода я просматриваю все строки в файле и вставляю записи в db.