Mysql create table int with unsigned int column example sql command to caeate table with
mysql create unsigned int column and mysql create table unsigned int primary key in below
Mysql create unsigned int column
using key word UNSIGNED after datatype of field for example
CREATE TABLE test_table (
test_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
test_desc TEXT
);
Mysql create table unsigned int primary key
CREATE TABLE test_table (
test_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
test_desc TEXT
PRIMARY KEY ('test_id')
);
Note: using keyword UNSIGNED to tell the data type is UNSIGNED and using keyword PRIMARY KEY (fieldname) to tell this field is primary key
Example for using Spring Framework Interceptor for do something before go to Controller
Interceptor Class
package com.en.interceptor;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import com.en.model.MasterModel;
public class MasterInterceptor extends HandlerInterceptorAdapter{
private String errorURL;
private MasterModel model;
public String getErrorURL() {
return errorURL;
}
public void setErrorURL(String errorURL) {
this.errorURL = errorURL;
}
public MasterModel getModel() {
return model;
}
public void setModel(MasterModel model) {
this.model = model;
}
}
package com.en.interceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
public class ExampleInterceptor extends MasterInterceptor{
private static Logger logger = Logger.getLogger(ExampleInterceptor.class);
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//request.getRequestDispatcher(errorURL).forward(request, response);
//return false;
logger.info("Interceptor running");
return true;
}
}
Spring Configuration is the same for Spring Bean config
Config to URL Mapping that need to use interseptor
<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="interceptors">
<list>
<ref local="exampleInterceptor"/>
</list>
</property>
<property name="mappings">
<props>
<prop key="/example_insert.html">exampleController</prop>
<prop key="/example_load.html">exampleController</prop>
<prop key="/example_delete.html">exampleController</prop>
<prop key="/example_ws.html">exampleController</prop>
<prop key="/example_sap.html">exampleController</prop>
</props>
</property>
</bean>