Java spring hibernate tutorial eclipse12/26/2023 ![]() The most convenient way to do that in Eclipse is to add MySQL database to data sources and create entity directly from the table. To communicate with database using Hibernate we have to create entities, which are layer between database and business interface of our application. IntegrationProject contextConfigLocation /WEB-INF/applicationContext.xml log4jConfigLocation /WEB-INF/classes/resources/logs/log4j.properties .Log4jConfigListener .ContextLoaderListener index.html Entities In order to enable the integration the following changes should be done to web.xml file. applicationContext.xml is default name and can be changed in web.xml file. For convenience it includes imports of appropriate files with Spring Beans. This file is used by Spring to create appropriate Spring Beans. ![]() Spring Bean defined to create session factory for hibernate. WEB-INF/classes/resources/database/database.properties Hibernate.xml Spring Bean defined to connect to database. = path_to_your_log_directory/IntegrationProject.log = DEBUG, console, file DataSource.xml Log4j.rootLogger = ERROR, console, file = System.out = # AdminFileAppender - used to log messages in the admin.log file. Again, replace bold values with the correct settings. This file includes information used to log the data. password = integrationProjectPassword log4j.properties ![]() ![]() Make sure that jdbc.url, ername, and jdbc.password are updated with your settings. This file includes information used to connect to database. The content of the files is presented in the following part of this section. In order to integrate the project with Spring and Hibernate a number of the files presented in Figure 5 have to be created. This is part 2 of the Java Technologies Integration tutorial. ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |