Rack Database Access 2

I use the JDBC drivers in the java action class file to access the database in struts 2. But, as mentioned on this site, there is another way to access the database in racks using the tag in the struts.xml file. But this does not work for me in struts 2. My question is, is there any other more efficient way to access the database in struts2, besides using JDBC drivers, because I have to connect every time I access any class file action? And I do not use hibernate, only want to use Struts.

+4
source share
1 answer

In a Java EE web application, database connections must be managed and integrated in the EJB; warfare must not know anything about the data source or database connection information.

If you can choose which technology to include in your web application, I highly recommend Spring to manage database connections.

Struts2 + Spring Integration Example .

Note. Spring libraries have nothing to do with Spring MVC, which is an alternative to the Framework for Struts2.


Edit

Things are changing now for persistence / ORM. I offer pure Java EE JPA2 on top of Spring.

+3
source

Source: https://habr.com/ru/post/1445924/


All Articles