Spring3 integrates hibernate 4

Updated on technology 2024-04-30
5 answers
  1. Anonymous users2024-02-08

    Don't close the session at the end of using currentsession, that is, don't write it; This will allow you to use the session object you have created in the current thread. When using OpenSession, you must remember to close the session. As for the transaction not being committed, check whether your transaction configuration is correct and whether there is an exception that causes the transaction to be rolled back.

  2. Anonymous users2024-02-07

    To get the current session, you need to configure it in the Hibernate or Spring configuration file, or you can manually commit the transaction.

  3. Anonymous users2024-02-06

    This is possible:

    Use annotations to declare the class as a bean

    Use Auto-Scan Beans to scan the beans of all annotation configurations under the package<>

    This way, you only need to let the DAO layer implementation class inherit from the tool class (hibernatetemplet) each time, which is as convenient as the previous tool class in hibernate 3. As shown in the figure, getbyid(). is also provided in this classand so on, saving a lot of uselessness for the DAO layer.

    This is my company's cattle package, I will only use it, if you need to leave a buckle fuel tank or something, I will send it to you!

  4. Anonymous users2024-02-05

    If you set BaseDAO as the parent class of all DAOs, the DAOs will inherit it, and you can use its public methods directly.

  5. Anonymous users2024-02-04

    A typical J2EE three-tier structure is divided into a presentation layer, an intermediate layer (business logic layer), and a data service layer. The three-tier system places business rules, data access, and legitimacy verification in the middle layer. The client does not interact directly with the database, but rather establishes a connection to the middle tier through components, which in turn interacts with the database.

    Since its advent in 1999, after years of development, its wide application and stable performance have laid a solid foundation for it as a presentation layer technology.

    The middle layer uses the popular spring+hibernate, which is subdivided into the following types in order to separate the control layer from the business logic layer.

    The web layer is the "C" (controller) in the MVC mode, which is responsible for controlling the interaction between the business logic layer and the presentation layer, calling the business logic layer, and returning business data to the presentation layer for organizational performance.

    The service layer (i.e., the business logic layer) is responsible for implementing the business logic. The business logic layer is based on the DAO layer, and the business logic required by the system is completed through the positive pattern wrapping of the DAO components.

    The DAO layer, which is responsible for interacting with persistent objects. This layer encapsulates the operations of adding, deleting, querying, and modifying data.

    po, persistent object. The Entity Relationship Mapping tool maps the data of the relational database into objects, making it easy to manipulate the database in an object-oriented manner, and the system uses Hibernate as the ORM framework.

    Spring's role runs through the entire middle layer, seamlessly integrating the web layer, service layer, DAO layer and PO, and its data service layer is used to store data.

    A good framework can reduce the burden and effort of developers to re-establish solutions to complex problems; It can be extended for internal customization; And there is a strong community of users to support it. Frameworks are usually a good solution to a problem. However, your application is layered, and each layer may need its own framework.

    Just by solving the UI problem doesn't mean that you can couple the business logic and persistence logic well with the UI components.

Related questions
10 answers2024-04-30

As a student who came out of Sowai.com (the ** on which everyone who does SEO), it is necessary to help you answer it. >>>More

2 answers2024-04-30

DHCP is a very useful network protocol. We have also done a lot of study and research on it. So here we are mainly talking about the content of the H3C S3600 DHCP Server configuration. >>>More

8 answers2024-04-30

It's almost on, and it's installed tomorrow.

17 answers2024-04-30

Hello, 5000km of mineral oil for car maintenance, 7500km of semi-synthetic engine oil for maintenance, and 10000km of fully synthetic engine oil for maintenance.

15 answers2024-04-30

The H61M-P23(B3) entry-level small board does not have two PCI-E slots, so it cannot install 2 graphics cards. There is also the Onda 9800GT and Yingzhong GTX460 Ice Dragon, these two graphics cards cannot form SLI, you can only install one of them, Yingzhong GTX460 performance is stronger than 9800GT, you can install it.