SHARE
TWEET

Untitled

a guest May 23rd, 2018 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. spring.jpa.hibernate.ddl-auto=validate or none
  2.    
  3. server.port=8080
  4. spring.datasource.url=jdbc:oracle:thin:@//qdb:1710/qschema
  5. spring.datasource.username=CRUDUSER
  6. spring.datasource.password=crudpassword
  7. spring.datasource.driverClassName = oracle.jdbc.OracleDriver
  8. spring.jdbc.template.fetch-size=-1
  9. spring.jdbc.template.max-rows=-1
  10. spring.jdbc.template.query-timeout=200
  11.  
  12. spring.h2.console.enabled=false
  13. spring.h2.console.path=/h2
  14.  
  15. spring.data.jpa.repositories.enabled=true
  16. spring.jpa.generate-ddl=false
  17. spring.jpa.hibernate.ddl-auto=none
  18. spring.jpa.open-in-view=true
  19. spring.jpa.show-sql=true
  20. spring.flyway.enabled=false
  21. spring.jpa.properties.javax.persistence.validation.mode=none
  22.    
  23. import org.springframework.boot.Banner;
  24. import org.springframework.boot.SpringApplication;
  25. import org.springframework.boot.autoconfigure.SpringBootApplication;
  26.  
  27.  
  28. @SpringBootApplication
  29.  
  30. public class AppApplication {
  31.  
  32.     public static void main(String[] args) {
  33.  
  34.  
  35.            String[] appArgs = {"--debug"};
  36.  
  37.            SpringApplication app = new SpringApplication(AppApplication.class);
  38.            app.setBannerMode(Banner.Mode.OFF);
  39.            app.setLogStartupInfo(false);
  40.            app.run(appArgs);        
  41.     }
  42. }
  43.    
  44. import org.springframework.web.bind.annotation.RequestMapping;
  45. import org.springframework.web.bind.annotation.RestController;
  46.  
  47. @RestController
  48. public class HomeController {
  49.  
  50.     @RequestMapping("/")
  51.     public String home() {
  52.         return " You've reached the home controller";
  53.     }
  54.     @RequestMapping("/admin")
  55.     public String admin() {
  56.         return " You've reached the admin home controller";
  57.     }
  58.  
  59.     @RequestMapping("/dashboard")
  60.     public String dashdoard() {
  61.         return " You've reached the dashboard home controller";
  62.     }
  63.  
  64.     @RequestMapping("/serviceCenter")
  65.     public String serviceCenter() {
  66.         return " You've reached the serviceCenter home controller";
  67.     }
  68.  
  69. //  @RequestMapping("/error")
  70. //  public String error() {
  71. //      return " You've reached the error page";
  72. //  }
  73. }
  74.    
  75. package com.fpl.pdit.model;
  76.  
  77. import java.util.Date;
  78.  
  79. import javax.persistence.Column;
  80. import javax.persistence.Entity;
  81. import javax.persistence.Id;
  82.  
  83. import org.hibernate.annotations.Immutable;
  84.  
  85.  
  86. @Entity
  87. @Immutable
  88.  
  89. public class Center {
  90.  
  91.     @Id
  92.     @Column
  93.     String symbol;
  94.     @Column
  95.     String center;
  96.     @Column
  97.     String messaging;
  98.     @Column
  99.     String slid;
  100.     @Column
  101.     Date last_modified;
  102.     @Column
  103.     String area_name;
  104.  
  105.  
  106.     public Center() {}
  107.     public Center(String symbol, String center, String messaging, String slid, Date last_modified,
  108.             String area_name) {
  109.         super();
  110.         this.symbol = symbol;
  111.         this.center = center;
  112.         this.messaging = messaging;
  113.         this.slid = slid;
  114.         this.last_modified = last_modified;
  115.         this.area_name = area_name;
  116.     }
  117.     public String getSymbol() {
  118.         return symbol;
  119.     }
  120.     public void setSymbol(String symbol) {
  121.         this.symbol = symbol;
  122.     }
  123.     public String getcenter() {
  124.         return center;
  125.     }
  126.     public void setCenter(String center) {
  127.         this.center = center;
  128.     }
  129.     public String getMessaging() {
  130.         return messaging;
  131.     }
  132.     public void setMessaging(String messaging) {
  133.         this.messaging = messaging;
  134.     }
  135.     public String getSlid() {
  136.         return slid;
  137.     }
  138.     public void setSlid(String slid) {
  139.         this.slid = slid;
  140.     }
  141.     public Date getLast_modified() {
  142.         return last_modified;
  143.     }
  144.     public void setLast_modified(Date last_modified) {
  145.         this.last_modified = last_modified;
  146.     }
  147.     public String getArea_name() {
  148.         return area_name;
  149.     }
  150.     public void setArea_name(String area_name) {
  151.         this.area_name = area_name;
  152.     }
  153.  
  154.  
  155.  
  156.  
  157.  
  158. }
  159.    
  160. package com.fpl.pdit.controller;
  161.  
  162. import java.util.ArrayList;
  163. import java.util.HashMap;
  164. import java.util.List;
  165. import java.util.Map;
  166.  
  167.  
  168.  
  169.     public class CenterStub {
  170.         private static Map <String, Center> centers = new HashMap <String, Center> ();
  171.  
  172.         static {
  173.             ServiceCenter sc = new Center("WWW","Center0","Y", null, null, null);
  174.             centers.put(sc.getCenter(), sc);
  175.             sc = new Center("XXX","Center1","Y", null, null, null);
  176.             centers.put(sc.getCenter(), sc);
  177.             sc = new Center("YYY","Center2","Y", null, null, null);
  178.             centers.put(sc.getcenter(), sc);
  179.         }
  180.  
  181.         public static List<Center> list() {
  182.             return new ArrayList<Center>(centers.values());
  183.         }
  184.  
  185.  
  186.         public static Center get(String symbol) {
  187.             return centers.get(symbol);
  188.         }
  189.  
  190.         public static Center update(String symbol, Center sc) {
  191.             centers.put(symbol, sc);
  192.             return sc;
  193.         }
  194.  
  195.  
  196.     }
  197.    
  198. import java.util.List;
  199.  
  200. import org.springframework.data.jpa.repository.JpaRepository;
  201. import org.springframework.data.jpa.repository.Query;
  202.  
  203. import com.fpl.pdit.model.Center;
  204.  
  205. public interface CenterRepository extends JpaRepository<Center, String>{
  206.  
  207.  
  208.  
  209. }
  210.    
  211. import javax.sql.DataSource;
  212.  
  213. import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
  214. import org.springframework.boot.context.properties.ConfigurationProperties;
  215. import org.springframework.boot.jdbc.DataSourceBuilder;
  216. import org.springframework.context.annotation.Bean;
  217. import org.springframework.context.annotation.Configuration;
  218. import org.springframework.context.annotation.Primary;
  219.  
  220. import com.zaxxer.hikari.HikariDataSource;
  221.  
  222. @Configuration
  223. public class PersistenceConfiguration {
  224.     @Bean
  225.     @ConfigurationProperties(prefix="spring.datasource")
  226.     @Primary
  227.     public DataSource dataSource() {
  228.         return DataSourceBuilder.create().build();
  229.     }
  230.  
  231.       @Bean
  232.         @ConfigurationProperties("spring.datasource")
  233.         public HikariDataSource dataSource(DataSourceProperties properties) {
  234.             return properties.initializeDataSourceBuilder().type(HikariDataSource.class)
  235.                     .build();
  236.         }
  237.  
  238. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top