質問編集履歴
4
修正いたしました
title
CHANGED
File without changes
|
body
CHANGED
@@ -6,37 +6,28 @@
|
|
6
6
|
DBにはIDだけ値が入っており、名前とメモにテキストボックスに入力した値が入っていないのですが、
|
7
7
|
原因は何になるのでしょうか?
|
8
8
|
ご回答のほど宜しくお願い致します
|
9
|
-
###発生している問題・エラーメッセージ
|
10
|
-
|
11
9
|
```
|
12
|
-
エラーメッセージ
|
13
|
-
2016-08-21
|
14
|
-
2016-08-21
|
15
|
-
|
16
|
-
|
17
|
-
2016-08-21
|
18
|
-
2016-08-21
|
19
|
-
2016-08-21
|
20
|
-
2016-08-21
|
21
|
-
2016-08-21
|
22
|
-
2016-08-21 10:47:01.423 INFO 636 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
|
23
|
-
2016-08-21 10:47:02.154 INFO 636 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@35d019a3: startup date [Sun Aug 21 10:46:56 JST 2016]; root of context hierarchy
|
24
|
-
2016-08-21 10:47:02.305 INFO 636 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/],methods=[GET]}" onto public org.springframework.web.servlet.ModelAndView com.tuyano.springboot.HeloController.index(org.springframework.web.servlet.ModelAndView)
|
25
|
-
2016-08-21 10:47:02.307 INFO 636 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/],methods=[POST]}" onto public org.springframework.web.servlet.ModelAndView com.tuyano.springboot.HeloController.form(java.lang.String,java.lang.String,org.springframework.web.servlet.ModelAndView)
|
26
|
-
2016-08-21 10:47:02.307 INFO 636 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/find],methods=[GET]}" onto public org.springframework.web.servlet.ModelAndView com.tuyano.springboot.HeloController.find(org.springframework.web.servlet.ModelAndView)
|
27
|
-
2016-08-21 10:47:02.308 INFO 636 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/find],methods=[POST]}" onto public org.springframework.web.servlet.ModelAndView com.tuyano.springboot.HeloController.search(java.lang.String,org.springframework.web.servlet.ModelAndView)
|
28
|
-
2016-08-21 10:47:02.312 INFO 636 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
|
29
|
-
2016-08-21 10:47:02.312 INFO 636 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
|
30
|
-
2016-08-21 10:47:02.360 INFO 636 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
|
31
|
-
2016-08-21 10:47:02.361 INFO 636 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
|
32
|
-
2016-08-21 10:47:02.436 INFO 636 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
|
33
|
-
2016-08-21 10:47:03.208 INFO 636 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
|
34
|
-
2016-08-21 10:47:03.320 INFO 636 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
|
35
|
-
2016-08-21 10:47:03.329 INFO 636 --- [ main] c.t.springboot.SokutakuhaiApplication : Started SokutakuhaiApplication in 8.455 seconds (JVM running for 9.286)
|
10
|
+
エラーメッセージ(修正後)
|
11
|
+
2016-08-21 21:29:22.614 INFO 1279 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
|
12
|
+
2016-08-21 21:29:23.410 INFO 1279 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
|
13
|
+
2016-08-21 21:29:23.507 INFO 1279 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
|
14
|
+
2016-08-21 21:29:23.515 INFO 1279 --- [ main] c.t.springboot.SokutakuhaiApplication : Started SokutakuhaiApplication in 8.004 seconds (JVM running for 8.653)
|
15
|
+
2016-08-21 21:29:31.213 INFO 1279 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring FrameworkServlet 'dispatcherServlet'
|
16
|
+
2016-08-21 21:29:31.213 INFO 1279 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization started
|
17
|
+
2016-08-21 21:29:31.238 INFO 1279 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization completed in 25 ms
|
18
|
+
2016-08-21 21:29:31.335 INFO 1279 --- [nio-8080-exec-1] o.h.h.i.QueryTranslatorFactoryInitiator : HHH000397: Using ASTQueryTranslatorFactory
|
19
|
+
2016-08-21 21:29:31.580 ERROR 1279 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.orm.jpa.JpaSystemException: No default constructor for entity: : com.tuyano.springboot.MyDataMongo; nested exception is org.hibernate.InstantiationException: No default constructor for entity: : com.tuyano.springboot.MyDataMongo] with root cause
|
36
20
|
|
21
|
+
org.hibernate.InstantiationException: No default constructor for entity: : com.tuyano.springboot.MyDataMongo
|
22
|
+
at org.hibernate.tuple.PojoInstantiator.instantiate(PojoInstantiator.java:84) ~[hibernate-core-5.0.9.Final.jar:5.0.9.Final]
|
23
|
+
at org.hibernate.tuple.PojoInstantiator.instantiate(PojoInstantiator.java:100) ~[hibernate-core-5.0.9.Final.jar:5.0.9.Final]
|
24
|
+
at org.hibernate.tuple.entity.AbstractEntityTuplizer.instantiate(AbstractEntityTuplizer.java:631) ~[hibernate-core-5.0.9.Final.jar:5.0.9.Final]
|
25
|
+
at org.hibernate.persister.entity.AbstractEntityPersister.instantiate(AbstractEntityPersister.java:4616) ~[hibernate-core-5.0.9.Final.jar:5.0.9.Final]
|
26
|
+
at org.hibernate.internal.SessionImpl.instantiate(SessionImpl.java:1470) ~[hibernate-core-5.0.9.Final.jar:5.0.9.Final]
|
27
|
+
at org.hibernate.internal.SessionImpl.instantiate(SessionImpl.java:1454) ~[hibernate-core-5.0.9.Final.jar:5.0.9.Final]
|
37
28
|
```
|
38
29
|
```java
|
39
|
-
・HeloController
|
30
|
+
・HeloController(修正後)
|
40
31
|
package com.tuyano.springboot;
|
41
32
|
|
42
33
|
import java.util.List;
|
@@ -73,7 +64,7 @@
|
|
73
64
|
@RequestParam("name")String name,
|
74
65
|
@RequestParam("memo")String memo,
|
75
66
|
ModelAndView mov){
|
76
|
-
MyDataMongo mydata =new MyDataMongo();
|
67
|
+
MyDataMongo mydata =new MyDataMongo(name,memo);
|
77
68
|
System.out.println("mydataは"+mydata);
|
78
69
|
repository.saveAndFlush(mydata);
|
79
70
|
mov =new ModelAndView("redirect:/");
|
@@ -105,15 +96,13 @@
|
|
105
96
|
mav.addObject("value",param);
|
106
97
|
List<MyDataMongo> list=repository.findByName(param);
|
107
98
|
mav.addObject("dataList",list);
|
108
|
-
|
109
|
-
|
110
|
-
|
99
|
+
}
|
111
100
|
return mav;
|
112
101
|
}
|
113
102
|
}
|
114
103
|
```
|
115
104
|
```java
|
116
|
-
・MyDataMongo.java
|
105
|
+
・MyDataMongo.java(修正後)
|
117
106
|
package com.tuyano.springboot;
|
118
107
|
|
119
108
|
import java.util.Date;
|
@@ -124,7 +113,6 @@
|
|
124
113
|
import javax.persistence.GenerationType;
|
125
114
|
import javax.persistence.Id;
|
126
115
|
import javax.persistence.Table;
|
127
|
-
|
128
116
|
@Entity
|
129
117
|
@Table(name="Linefriend")
|
130
118
|
public class MyDataMongo {
|
@@ -138,13 +126,17 @@
|
|
138
126
|
@Column
|
139
127
|
private String memo;
|
140
128
|
//private Date date;
|
129
|
+
public MyDataMongo(String name, String memo) {
|
130
|
+
super();
|
131
|
+
this.name=name;
|
132
|
+
this.memo=memo;
|
133
|
+
}
|
141
134
|
|
142
|
-
|
143
|
-
public void setId(Long id){
|
135
|
+
//public void setId(Long id){
|
144
136
|
|
145
|
-
this.id=id;
|
137
|
+
// this.id=id;
|
146
138
|
|
147
|
-
}
|
139
|
+
//}
|
148
140
|
|
149
141
|
public Long getId(){
|
150
142
|
|
@@ -159,34 +151,25 @@
|
|
159
151
|
|
160
152
|
}
|
161
153
|
|
162
|
-
public void setName(String name){
|
163
|
-
|
164
|
-
this.name=name;
|
165
|
-
|
166
|
-
}
|
167
154
|
|
168
155
|
|
169
156
|
|
157
|
+
|
170
158
|
public String getMemo(){
|
171
159
|
|
172
160
|
return memo;
|
173
161
|
|
174
162
|
}
|
175
163
|
|
176
|
-
|
164
|
+
|
177
|
-
|
178
|
-
|
165
|
+
|
179
|
-
|
166
|
+
|
167
|
+
|
168
|
+
|
180
169
|
}
|
181
170
|
|
182
|
-
|
171
|
+
|
183
|
-
|
184
|
-
//return date;
|
185
|
-
|
186
|
-
//}
|
187
|
-
}
|
188
172
|
```
|
189
|
-
|
190
173
|
```HTML
|
191
174
|
・index.html
|
192
175
|
<!DOCTYPE html>
|
3
コードの箇所を``` ```で囲むように再度修正いたしましたので宜しくお願い致します
title
CHANGED
File without changes
|
body
CHANGED
@@ -34,9 +34,7 @@
|
|
34
34
|
2016-08-21 10:47:03.320 INFO 636 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
|
35
35
|
2016-08-21 10:47:03.329 INFO 636 --- [ main] c.t.springboot.SokutakuhaiApplication : Started SokutakuhaiApplication in 8.455 seconds (JVM running for 9.286)
|
36
36
|
|
37
|
-
|
37
|
+
```
|
38
|
-
|
39
|
-
|
40
38
|
```java
|
41
39
|
・HeloController
|
42
40
|
package com.tuyano.springboot;
|
@@ -114,7 +112,7 @@
|
|
114
112
|
}
|
115
113
|
}
|
116
114
|
```
|
117
|
-
|
115
|
+
```java
|
118
116
|
・MyDataMongo.java
|
119
117
|
package com.tuyano.springboot;
|
120
118
|
|
@@ -127,9 +125,6 @@
|
|
127
125
|
import javax.persistence.Id;
|
128
126
|
import javax.persistence.Table;
|
129
127
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
128
|
@Entity
|
134
129
|
@Table(name="Linefriend")
|
135
130
|
public class MyDataMongo {
|
@@ -190,7 +185,9 @@
|
|
190
185
|
|
191
186
|
//}
|
192
187
|
}
|
188
|
+
```
|
193
189
|
|
190
|
+
```HTML
|
194
191
|
・index.html
|
195
192
|
<!DOCTYPE html>
|
196
193
|
<html xmlns:th="http://www.thymeleaf.org">
|
@@ -224,7 +221,9 @@
|
|
224
221
|
|
225
222
|
</body>
|
226
223
|
</html>
|
224
|
+
```
|
227
225
|
|
226
|
+
```java
|
228
227
|
・MyDataMongoRepository.java
|
229
228
|
package com.tuyano.springboot.repositories;
|
230
229
|
|
@@ -238,4 +237,5 @@
|
|
238
237
|
public interface MyDataMongoRepository extends JpaRepository<MyDataMongo,Long>{
|
239
238
|
List<MyDataMongo>findByName(String s);
|
240
239
|
}
|
240
|
+
|
241
241
|
```
|
2
コードの箇所を``` ```で囲むように修正いたしましたので宜しくお願い致します
title
CHANGED
File without changes
|
body
CHANGED
@@ -36,7 +36,8 @@
|
|
36
36
|
|
37
37
|
|
38
38
|
|
39
|
+
|
39
|
-
```
|
40
|
+
```java
|
40
41
|
・HeloController
|
41
42
|
package com.tuyano.springboot;
|
42
43
|
|
@@ -112,6 +113,7 @@
|
|
112
113
|
return mav;
|
113
114
|
}
|
114
115
|
}
|
116
|
+
```
|
115
117
|
|
116
118
|
・MyDataMongo.java
|
117
119
|
package com.tuyano.springboot;
|
1
コードの箇所を``` ```で囲むように修正いたしましたので宜しくお願い致します
title
CHANGED
File without changes
|
body
CHANGED
@@ -35,9 +35,8 @@
|
|
35
35
|
2016-08-21 10:47:03.329 INFO 636 --- [ main] c.t.springboot.SokutakuhaiApplication : Started SokutakuhaiApplication in 8.455 seconds (JVM running for 9.286)
|
36
36
|
|
37
37
|
|
38
|
-
|
38
|
+
|
39
39
|
```ここに言語を入力
|
40
|
-
ここにご自身が実行したソースコードを書いてください
|
41
40
|
・HeloController
|
42
41
|
package com.tuyano.springboot;
|
43
42
|
|
@@ -236,4 +235,5 @@
|
|
236
235
|
@Repository
|
237
236
|
public interface MyDataMongoRepository extends JpaRepository<MyDataMongo,Long>{
|
238
237
|
List<MyDataMongo>findByName(String s);
|
239
|
-
}
|
238
|
+
}
|
239
|
+
```
|