Skip to content

Instantly share code, notes, and snippets.

View SakaDream's full-sized avatar
😮‍💨
sleeping...

Hai Phan SakaDream

😮‍💨
sleeping...
View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:b="http://bootsfaces.net/ui">
<h:head>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:b="http://bootsfaces.net/ui">
<h:head>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
package com.sakadream.jsf.validator;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.validator.FacesValidator;
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;
/**
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:b="http://bootsfaces.net/ui">
<h:head>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:b="http://bootsfaces.net/ui"
xmlns:c="http://java.sun.com/jsp/jstl/core">
<h:head>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
...
<dependencies>
...
<dependency>
<groupId>org.hibernate.common</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<version>4.0.5.Final</version>
</dependency>
package com.sakadream;
import com.sakadream.models.Employee;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;
import java.util.Properties;
/**
* Created by Phan Ba Hai on 25/08/2017.
CREATE TABLE Employee (
id INT IDENTITY (1,1) PRIMARY KEY NOT NULL ,
name NVARCHAR(50) NOT NULL ,
address NVARCHAR(50) NOT NULL ,
phone VARCHAR(11) NOT NULL ,
salary INT NOT NULL
);
INSERT INTO Employee(name, address, phone, salary)
VALUES
package com.sakadream.models;
import javax.persistence.*;
/**
* Created by Phan Ba Hai on 25/08/2017.
*/
@Entity
@Table
public class Employee {
package com.sakadream.services;
import com.sakadream.models.Employee;
import java.util.List;
/**
* Created by Phan Ba Hai on 25/08/2017.
*/
public interface EmployeeService {