Guest User

Untitled

a guest
Sep 16th, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.38 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  4. <modelVersion>4.0.0</modelVersion>
  5. <groupId>com.example.studentInfo</groupId>
  6. <artifactId>studentOnlineInfo</artifactId>
  7. <version>0.0.1-SNAPSHOT</version>
  8. <packaging>jar</packaging>
  9. <name>studentOnlineInfo</name>
  10. <description>A web project which implements simple write and read to the database</description>
  11. <parent>
  12. <groupId>org.springframework.boot</groupId>
  13. <artifactId>spring-boot-starter-parent</artifactId>
  14. <version>2.0.5.RELEASE</version>
  15. <relativePath/> <!-- lookup parent from repository -->
  16. </parent>
  17. <properties>
  18. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  19. <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  20. <java.version>1.8</java.version>
  21. </properties>
  22. <dependencies>
  23. <dependency>
  24. <groupId>org.springframework.boot</groupId>
  25. <artifactId>spring-boot-starter-data-jpa</artifactId>
  26. </dependency>
  27. <dependency>
  28. <groupId>org.springframework.boot</groupId>
  29. <artifactId>spring-boot-starter-web</artifactId>
  30. </dependency>
  31. <dependency>
  32. <groupId>mysql</groupId>
  33. <artifactId>mysql-connector-java</artifactId>
  34. <scope>runtime</scope>
  35. </dependency>
  36. <dependency>
  37. <groupId>org.springframework.boot</groupId>
  38. <artifactId>spring-boot-starter-test</artifactId>
  39. <scope>test</scope>
  40. </dependency>
  41. </dependencies>
  42. <build>
  43. <plugins>
  44. <plugin>
  45. <groupId>org.springframework.boot</groupId>
  46. <artifactId>spring-boot-maven-plugin</artifactId>
  47. </plugin>
  48. </plugins>
  49. </build>
  50. </project>
  51.  
  52. <?xml version="1.0" encoding="UTF-8"?>
  53. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  54. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  55. <modelVersion>4.0.0</modelVersion>
  56. <groupId>com.example.studentInfo</groupId>
  57. <artifactId>studentOnlineInfo</artifactId>
  58. <version>0.0.1-SNAPSHOT</version>
  59. <packaging>jar</packaging>
  60. <name>studentOnlineInfo</name>
  61. <description>A web project which implements simple write and read to the database</description>
  62. <parent>
  63. <groupId>org.springframework.boot</groupId>
  64. <artifactId>spring-boot-starter-parent</artifactId>
  65. <version>2.0.5.RELEASE</version>
  66. <relativePath/> <!-- lookup parent from repository -->
  67. </parent>
  68. <properties>
  69. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  70. <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  71. <java.version>1.8</java.version>
  72. </properties>
  73. <dependencies>
  74. <dependency>
  75. <groupId>org.springframework.boot</groupId>
  76. <artifactId>spring-boot-starter-data-jpa</artifactId>
  77. </dependency>
  78. <dependency>
  79. <groupId>org.springframework.boot</groupId>
  80. <artifactId>spring-boot-starter-web</artifactId>
  81. </dependency>
  82. <dependency>
  83. <groupId>mysql</groupId>
  84. <artifactId>mysql-connector-java</artifactId>
  85. <scope>runtime</scope>
  86. </dependency>
  87. <dependency>
  88. <groupId>org.springframework.boot</groupId>
  89. <artifactId>spring-boot-starter-test</artifactId>
  90. <scope>test</scope>
  91. </dependency>
  92. </dependencies>
  93. <build>
  94. <plugins>
  95. <plugin>
  96. <groupId>org.springframework.boot</groupId>
  97. <artifactId>spring-boot-maven-plugin</artifactId>
  98. </plugin>
  99. </plugins>
  100. </build>
  101. </project>
  102.  
  103. spring.datasource.url=jdbc:mysql://localhost:3306/studentInfo
  104. spring.datasource.username=root
  105. spring.datasource.password=Christensen001
  106. spring.datasource.driver-class-name=com.mysql.jdbc.Driver
  107. spring.jpa.show-sql=true
  108. spring.mvc.view.prefix=/WEB-INF/jsps/
  109. spring.mvc.view.suffix=.jsp
  110.  
  111. package com.example.studentInfo.entities;
  112. import javax.persistence.Column;
  113. import javax.persistence.Entity;
  114. import javax.persistence.Id;
  115. import javax.persistence.Table;
  116. @Entity
  117. @Table(name="studenData")
  118. public class StudentInformation {
  119. @Id
  120. private long id;
  121. @Column(name="sreg_num")
  122. private String reg_num;
  123. @Column(name="semail")
  124. private String email;
  125. @Column(name="sname")
  126. private String name;
  127. @Column(name="sage")
  128. private int age;
  129. @Column(name="sstate")
  130. private String state;
  131. @Column(name="scity")
  132. private String city;
  133. public long getId() {
  134. return id;
  135. }
  136. public void setId(long id) {
  137. this.id = id;
  138. }
  139. public String getReg_num() {
  140. return reg_num;
  141. }
  142. public void setReg_num(String reg_num) {
  143. this.reg_num = reg_num;
  144. }
  145. public String getEmail() {
  146. return email;
  147. }
  148. public void setEmail(String email) {
  149. this.email = email;
  150. }
  151. public String getName() {
  152. return name;
  153. }
  154. public void setName(String name) {
  155. this.name = name;
  156. }
  157. public int getAge() {
  158. return age;
  159. }
  160. public void setAge(int age) {
  161. this.age = age;
  162. }
  163. public String getState() {
  164. return state;
  165. }
  166. public void setState(String state) {
  167. this.state = state;
  168. }
  169. public String getCity() {
  170. return city;
  171. }
  172. public void setCity(String city) {
  173. this.city = city;
  174. }
  175. public StudentInformation(long id, String reg_num, String email, String name, int age, String state, String city) {
  176. super();
  177. this.id = id;
  178. this.reg_num = reg_num;
  179. this.email = email;
  180. this.name = name;
  181. this.age = age;
  182. this.state = state;
  183. this.city = city;
  184. }
  185. @Override
  186. public String toString() {
  187. return "StudentInformation [id=" + id + ", reg_num=" + reg_num + ", email=" + email + ", name=" + name
  188. + ", age=" + age + ", state=" + state + ", city=" + city + "]";
  189. }
  190. } </pre>
  191.  
  192. package com.example.studentInfo;
  193.  
  194. import org.springframework.boot.SpringApplication;
  195. import org.springframework.boot.autoconfigure.SpringBootApplication;
  196.  
  197. @SpringBootApplication
  198. public class StudentOnlineInfoApplication {
  199.  
  200. public static void main(String[] args) {
  201. SpringApplication.run(StudentOnlineInfoApplication.class, args);
  202. }
  203. }
  204.  
  205. Likely a corrupt download. Try removing ~/.m2/respository.
  206.  
  207. spring.jpa.hibernate.ddl-auto=create
  208. spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL57Dialect
  209.  
  210. @Id
  211. @GeneratedValue(strategy = GenerationType.IDENTITY)
  212. @Column(name = "id")
  213. private Long id;
  214.  
  215. <dependency>
  216. <groupId>org.apache.tomcat.embed</groupId>
  217. <artifactId>tomcat-embed-core</artifactId>
  218. <scope>provided</scope>
  219. </dependency>
Add Comment
Please, Sign In to add comment