There is a web application that runs on tomcat . There is also another application, a console, run through the main method. Both the one and the second applications contain a DAO layer using Hibernate . The entities in both applications are the same, and adding a new one to one of the applications requires duplicating it on the second, which is not very convenient.
I would like to combine these two applications into one, so that they have a common entity package and a DAO layer, a common pool of hibernate connections. I am not sure that this is possible, as the Web application in my understanding works after the arrival of the Request on the Servlet .
Tell me, please, is such a scheme realizable?
PS
, That it is possible to use listener , it can be an output?