This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.bytestree.restful.model; | |
import javax.persistence.Column; | |
import javax.persistence.Entity; | |
import javax.persistence.GeneratedValue; | |
import javax.persistence.GenerationType; | |
import javax.persistence.Id; | |
import javax.persistence.Table; | |
@Entity |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.bytestree.restful.service; | |
import java.io.Serializable; | |
import java.util.List; | |
public interface CRUDService<E> { | |
E save(E entity); | |
E getById(Serializable id); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.bytestree.restful.controller; | |
import java.util.Arrays; | |
import java.util.List; | |
import org.apache.log4j.Logger; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.http.HttpStatus; | |
import org.springframework.http.ResponseEntity; | |
import org.springframework.web.bind.annotation.PathVariable; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.bytestree.restful; | |
import org.springframework.boot.SpringApplication; | |
import org.springframework.boot.autoconfigure.SpringBootApplication; | |
@SpringBootApplication | |
public class Application { | |
public static void main(String[] args) { | |
SpringApplication.run(Application.class, args); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.bytestree; | |
import org.springframework.context.annotation.AnnotationConfigApplicationContext; | |
import com.bytestree.config.AppConfiguration; | |
public class TestApplication { | |
public static void main(String[] args) { | |
// Load the Spring context and beans | |
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(AppConfiguration.class); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.bytestree; | |
import java.util.List; | |
import org.apache.log4j.Logger; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.stereotype.Component; | |
import com.bytestree.model.Employee; | |
import com.bytestree.service.EmployeeService; | |
@Component |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.bytestree.model; | |
import javax.persistence.Column; | |
import javax.persistence.Entity; | |
import javax.persistence.GeneratedValue; | |
import javax.persistence.GenerationType; | |
import javax.persistence.Id; | |
import javax.persistence.Table; | |
@Entity |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.bytestree.dao; | |
import java.io.Serializable; | |
import java.lang.reflect.ParameterizedType; | |
import java.util.List; | |
import org.hibernate.Session; | |
import org.hibernate.SessionFactory; | |
import org.hibernate.criterion.Example; | |
import org.springframework.beans.factory.annotation.Autowired; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Create table -- | |
CREATE TABLE employee | |
( | |
id bigserial NOT NULL, | |
firstname character varying(50), | |
lastname character varying(50), | |
designation character varying(50), | |
salary integer, | |
CONSTRAINT employee_pk PRIMARY KEY (id) | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.bytestree.config; | |
import org.springframework.context.annotation.ComponentScan; | |
import org.springframework.context.annotation.Configuration; | |
@Configuration | |
@ComponentScan(value={"com.bytestree"}) | |
public class AppConfiguration { | |
} |
NewerOlder