I would suggest you use a maven project and post the poms so we can clearly see the dependencies between the projects.
Spring + Hibernate implementation in multi-modules
-
29-08-2022 - |
質問
My problem - for the study Spring I write a not great application composed of several modules (multimoduls).
module1
src
entity
dao
resource
spring-config.xml ---> This is DataSource, SessionFactory, TransactionManager
module2
src
entity
dao
resource
spring-config.xml ---> This is DataSource, SessionFactory, TransactionManager
service1
src
service_for_module1
resource
spring-config.xml ---> Initialization bean Service1 (used for module1)
service2
src
service_for_module2
resource
spring-config.xml ---> Initialization bean Service2 (used for module2)
web
src
ManagerBeanForJSF
web
pages
WEB-INF
spring
spring-config.xml ---> Import all spring config from modules
I have exception org.hibernate.hql.internal.ast.QuerySyntaxException. When I did not have module2 - all worked successfully. Error associated with duplication of SessionFactory and TransactionManager? Can you give an example of application in Spring composed of several modules. Thanks.
正しい解決策はありません
他のヒント
As your question is a bit incomplete I can only guess you're using maven. Right? Anyway, when using Spring you should definitely, as you already wrote yourself, define the infrastructural part in one common module. Spring provides the possibility to include other context files. Even with wildcards. So you could define one singular main context file that loads those of all others in one go. The best is to have some sort of naming conventions, so that each module can easily contribute its context files.