-
This part of you:
Hibernate for persistence).
Construct a session factory omitted.
public void addnews(newsvo news){try{ ;Save, transaction start, and commit omitted.
It's the DAO layer, and your DAO layer is implemented with hibernate.
-
First of all, let's talk about the concept of ORM (Object Relation Mapping), where all data in a database is relational, and how to map it into objects is part of what Hibernate does.
The concept of a DAO is Data Access Objects.
This is the description of an object of class that he is an object.
This is the logical business layer in the MVC model.
This is only responsible for data storage, and he assembles hibernate to store data in the database, where the hibernate Chinese file maps the relational model in the database to the object model, which is the previous orm
Spring has a lot of features, I don't know what you mean, it has a lot of features, dependency injection, control flipping, general integration, Hibernate just lets Spring manage all the data sources in the DAO, dependency injection, and many more, depending on the actual application.
-
Look at your implementation, if it's a hib implementation, it's hib
-
SessionFactory is the factory class of Session, responsible for producing Session, Session is the entrance class (façade mode) for you to operate Hibernate, the data source is a property of SessionFactory, and SessionFactory gets it mainly to pass to Session, because the underlying operation of Hibernate is still through JDBC operation to complete the curd operation of data.
HibernatedaoSupport has a property that is SessionFactory, because your DAO class inherits it, so when you inject SessionFactory into the DAO class, you are actually injecting it into HibernatedAOSUPPORT.
-
SessionFactory produces sessions for use by DAO methods.
The session contains connections for database operations.
-
Write under the main method of the test class:
applicationcontext context = new classpathxmlapplicationcontext("");
employeedao employee = employeedao)"employeedao");Write the bean id that needs to be tested in parentheses;
admin", admin");Call the method that needs to be tested.
Then run, and it's OK.
I hope to help you.
-
Is it based on genuine ignorance or is it deliberate?
-
service layer.
The original meaning of the DAO layer should be basic atomic persistence operationsObviously, most transactions are made up of multiple persistence operations.
For example, a bank transfer theoretically contains at least two update statements) and the method in the service represents an independent and complete business logic, which corresponds to the concept of transaction.
so!It should be placed on the service layer undoubtedly!
-
service layer. Transaction control may be designed to be handled by other business content.
For example, when you delete a user, you also delete the user's post. There are also operations such as logging tables, which can be better controlled at the service layer.
-
service layer.
Why. The DAO layer only operates with the database.
And the service layer may have other operations.
If it is placed in the DAO layer, then the operation fails, and the other services of the service are not rolled back.
-
Start opening the project folder.
Found it. SpringBeans, open with Notepad, add the location of the Spring configuration file.
The location of the spring location file is not necessarily the same for everyone.
Finally, refresh the project and you're good to go.
I don't know why this is happening.,Some people say it's not following the standard steps.。。。
Civil law is the general term for the legal norms that regulate the personal and property relations between natural persons, legal persons, and other organizations of equal subjects. >>>More
It is impossible for two identical shapes in nature, but there are many approximate shapes: for example, the leaves of the same plant, the pebbles in the stream, the wind-blown sand dunes, etc., are all similar in shape. Approximation in plane composition refers to the basic shape composition picture that has common characteristics in shape, size, color, texture, etc., and presents a vivid and changing effect in unity. >>>More
The microcontroller (MCU) is the core of the ECU, the electronic control unit of the car, with the CPU as the core, which is a microcomputer integrated on a single chip. ECU is a general term for circuit boards that include microcontrollers and related peripheral devices, and is a microcontroller application system in automobiles. Embedded systems, that is, computer systems embedded in control objects, are not primarily used for computing, but for control. >>>More
The hardness of the stone is a relatively broad value, 1-10 degrees. 1. The stone talc with the smallest hardness, the hardness is 1, the gypsum hardness is 2, the hardness of Shoushan stone engraved with the seal is 3, fluorite is also called fluorite (fluorite) hardness is 5 apatite hardness, orthoclase hardness is 6, Hetian jade hardness quartz stone field hardness is 7, topaz hardness is 8, corundum hardness is 9, diamond hardness is 10. Generally, below 4 is soft stone, 4-7 below is neutral, and above 7 is hard.
Slow shake bar is a new concept of bar, the first from Hainan, Guangdong, Shanghai and other places began to popular, quickly popular throughout the country, is one of the most fashionable forms of entertainment, is a kind of bar, is between the quiet bar and the disco bar form of bar. Bar (originally written as 酒茇, 茇 is interpreted as a house, bar is a false word for 茇), refers to a place that provides beer, wine, liquor, cocktails and other alcoholic beverages. < >>>More