The following is an introduction to the integration of hibernate with spring, where the integration of the two frameworks depends on the configuration of the Applicationcontext.xml file, which is very simple, but it should be noted that importing the package must be imported to webroot/web-inf/ Lib directory, and hibernate is typically imported before
Spring Integration Hibernate:Hibernate: Interacting with the databaseSPRING:IOC AOPIntegration points:1.sessionFactory objects are no longer generated by hibernate and are generated by spring, that is, the configuration of the database connection information global configuration map file is done by spring2.IOC managing DAO Objects Basedao objectsControl of 3.AOP
The construction of the SSH Project source code has been uploaded to Baidu cloud disk. Without maven, download it down, and under ApplicationContext configuration MySQL, execute the next Test.sql script to run it.Links: http://pan.baidu.com/s/1nvqOcPjPassword: yv191. Configure Struts2A. Copy Struts2 jar PackageB. Set JSP encoding to UTF-8C. Add struts2 Filter to Web. xmlD. Add struts.xml to src directoryE. Adding a test action to test whether the STRUTS2 is configured successfully2. Configure Sp
in development using struts+spring+hibernate, a blob or CLOB field is typically used in an Oracle database to store binary pictures or attachments. can easily solve the problem of read and write blobs by using the mapping method provided by the usertype of spring to handle lob types. references are as follows: ==============================================
Saving Spring and Hibernate data
I will not talk about the advantages of Spring MVC. It is more comfortable to use Spring MVC than Struts2. As for the persistence layer, it is more inclined to use Hibernate, so I started to try to use Sp
In the sessionfactory configuration file of SSH2
Set hibernate. current_session_context_class to org. springframework. Orm. hibernate3.springsessioncontext (default value)
And apply spring to manage transactions.
If it is
In the source code of spring class localsessionfactorybean
In method buildsessionfactory
If
Hibernate provides its own transaction management implementation. However, when using spring to integrate hibernate, we recommend that you hand over the transaction to spring for programmatic transaction management.
1. User. Java
Package cn.com. Boyang;
Public class user {Private integer ID;Private string name;Private
Spring, hibernate, struts interview questions, hibernatestruts
1. Is Action thread-safe? If there is no way to ensure the thread security of Action? If yes, explain the reasonNoDeclare local variables, or expand RequestProcessor to create an Action each time, or use scope = "prototype" in spring to manage
2. MVC: analyze how struts implements MVC.M: JavaBean or c
, the 2nd is the use of interceptorsSpring+hibernate, if the set map uses lazy= "true", when the PO is passed to the view layer, an uninitialized session is closed, and only the DAO is initialized firstParent.getchilds (). Size ();Spring provides open Session in view to solve this problem, there are two ways1. Interceptorclass= "Org.springframework.orm.hibernate3.support.OpenSessionInViewInterceptor" >.....
In the java Enterprise application field, the powerful functions of ejbs are the same as the complicated configurations of ejbs, and they are also known for their difficulties in learning. But before, what can we do? You can only learn ejbs with a hard head. It is a bit of "understanding that there are tigers in the mountains and moving towards tigers. There has been an optimistic change in the form. The popularity of java open source has made the development of java Enterprise applications no l
EhCache is one of Hibernate's second-level cache technologies. It can store the queried data in memory or disk, saving the need to query the database again with the same query statement next time, greatly reducing the database pressure;
EhCache usage notes
When you use Hibernate to modify table data (save, update, delete, and so on), EhCache will automatically delete all the caches related to this table (this can achieve synchronization ). However, fo
the object is still in use. This can cause an important problem when trying to abstract the persistence layer through the DAO pattern. In order to fully abstract the persistence layer, all database logic, including open, closed sessions, cannot appear at the application level. Most often, the logic is hidden in the DAO's implementation class. A quick and poor solution is to avoid the DAO pattern and include the logic of the data connection in the application layer. This is feasible in small app
This article is a primer for developing Web applications based on spring, using the Struts MVC framework, the middle tier using spring, and the background using hibernate.
This article contains the following elements:
• Configure Hibernate and transactions
• Load Spring's applicationcontext.xml file
• Establish dep
Sorting out the answers to Daniel:
1. Get started looking at documents (blogs, books, etc.), in-depth understanding of the meaning of the configuration file (Spring, Struts, Hibernate);
2. Encounter problems, self-solve, if resolved, why this solution? (Always ask a question why)
3. Specifically to hibernate, the first thing to learn is the database,
Struts2 + Spring + Hibernate environment, struts2hibernate
Struts-2.3.20
Spring-1, 4.1.4
Hibernate-4.3.8
Slf4j-1.7.10
1. Create a database in MySQL
mysql> create database myoa default character set utf8
2. Create a Web Project in MyEclipse
Right-click on the project-Properties and set the code to UTF-8.
3. Configure
ObjectiveFrom the title of the article, it can be clearly understood that this article is to discriminate between three easy to confuse the novice technical terminology. If you know the difference and the relationship between the three nouns at the glance of the past, then this article you can not continue to read, unless you want to see what I have to explain the wrong, to correct (to find fault, haha), also welcome messages.noun explanation
JPA (Java persistence Api,java persistence A
A recent study of spring has a little understanding of AOP,IOC. First, I send a consolidated code
1, use the IDE is NetBeans, personally feel what tools are the same.
2, Code structure view
3, the various classes of code, first from the DAO, Iuserdao and Userdaoimpl This needless to say, is the persistence layer of code. Use spring to manage hibernate. First you
1. Is action thread-safe? If there is no way to ensure the thread security of action? If yes, explain the reasonIt is not thread-safe. Thread security can be ensured without declaring class variables. Because only one action instance exists, all threads share variables.
Declare local variables, or expand requestprocessor to create an action each time, or use scope = "prototype" in spring to manage
2. MVC: analyze how struts implements MVC.M: JavaBean
This time, let's take a look at the integrated applications of the three frameworks Struts2 + Spring + Hibernate, mainly the integration of Spring and Hibernate, because the front has already integrated Strtus2 + Spring.
Let's take a look at the division of labor:
Struts2's
Flex + J2EE instance (cairngorm + blazeds + hibernate + spring) Part3---- Add Spring hibernate
1. Add spring, Hibernate common jar under WEB-INF \ Lib, including MySQL database connection driver
2. Create a database in the MySQ
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.