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
Spring+struts2+hibernate Integrated development projects in addition to our regular methods, you can also use full annotations to make development more convenient and fast.One: Introducing a jar package that supports full annotation integration relatedSecond: Build the project structure (to add students as an example)Beans Layer@Entity@Table //database table
Why does spring integrate hibernate:1. General resource management.2. Excellent Management Mechanism (sessionfactory Management Mechanism Based on dependency injection ).3. Unified transaction management.4. Unified Exception Handling
Spring integrates hibernate:1. Configure the Data source:Spring has built-in implement
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
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
the model.First, the most important is the ability to have multiple views corresponding to a model. There may be multiple ways to access the application's requirements under the rapidly changing needs of the current user. For example, the order model may have orders for the system, there are online orders, or other system orders, but the processing of orders is the same, that is, the processing of orders is consistent. By MVC design mode, an order mo
Spring integrates Hibernate ing files in four ways,Summary:
In Spring applicationContext. the Hibernate ing file is integrated in xml, usually in the
An example of configuring a sessionFactory is as follows:
Directory: mappingResources
MappingResources: Specifies the speci
Struts2,hibernate,spring Integrated notes (1)Struts2,hibernate,spring Integrated Notes (2)Well, struts and hibernate are going to start with spring.The usual, or import the jar package firstSpring.jarAspectjrt.jarAspectjwerver.jarCglib-nodep-2.1_3.jarCommon-logging.jarC3p0-0
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
The support for hibernate in spring is very powerful. We can see from a simple example that we will also discuss the so-called lightweight container.
First, we need to configure the data source. Generally, we have two methods to obtain the connection. First, we need to write the data source by ourselves.CodeObtain the connection. The second is to obtain the d
When hibernate was used independently, Hibernate had its own configuration file hibernate. cfg. XML, which is now under spring management. The bean is merged into applicationcontext. xml.
Compare the previous configurations of Hibernate
One point is that the
These days in the Spring Boot development project, in the development process encountered a problem hibernate when executing SQL, the Always prompt table does not exist.After finding out, the table was built with a uniform capitalization. Hibernate converts uppercase to lowercase. And MySQL is case sensitive under Linux.Solve:1. Try to change the cnf file of MySQ
Problem
Reproducible Demo Code: Demo.zip
Recently troubleshooting a spring boot application that throws Hibernate.validator Noclassdeffounderror, the exception information is as follows:caused by:java.lang.NoClassDefFoundError:Could not initialize class Org.hibernate.validator.internal.engine.ConfigurationImpl at Org.hibernate.validator.HibernateValidator.createGenericConfiguration (hibernatevalidator.java:33) ~[
Spring + hibernate + tapestry is a new popular Java development framework. This article provides an example of processing the orcale blob field content under this development framework:
Orcale blob database ing in Hibernate is private byte [] ZP; // photo "ZP" blob, which is used to store employee photos.
/** @
query is followed by a set autocommit = 1.In the second case, you can use the jdbc url of the conn pool to set autocommit to true. However, MySQL driver does not seem to support this setting.
However, don't worry. We have an optimal solution, which can not only solve these two problems at once, but also solve the performance impact of read_only transactions.That is, lazyconnectionceceproxyThis conn proxy is used to issue queries to DB only when necessary. All unnecessary set autocommit = 0 comm
"; to + } - the}1234 - - + - + A at - - - - - in - to + - the * $Panax Notoginseng - the + A theYou can override the error prompt defined on a persisted object by defining a "validatemessage.properties" file, usually in the form of a property key in the properties file "@Annotation Name.object.fieldname":NotEmpty.customer.name = name is required! Range.customer.age = age value must is between 1 and 150Code Run Demo:Springmvc-bean-validation-jsr303-
1. Is action thread-safe? If there is no way to ensure the thread security of action? If yes, explain the reasonAction 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: JavaB
In Hibernate, every time we do an operation, we are going to start the transaction, then do the data operation, then commit the transaction, close the transaction, the reason is becauseHibernate default Transaction autocommit is False, it is necessary to manually commit the transaction, and if you do not want to commit the transaction manually every time, you canHibernate.cfg.xmlSet it as transaction autocommit in my file: PropertyName = "Hibernate.co
Okay, huh, cloud dizzy brain copy and paste so muchCode. Let's make a brief summary. Our small project involves the knowledge of extjs, JSON, DWR, spring, and hibernate components. It is not a task of learning to be proficient in every part of the project. Let's take a look at these framework technologies:
1. extjs is a very good Ajax framework that can be used to develop Ajax applications with rich cl
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.