我意識到有很多類似的問題,但沒有人幫助過我。Hibernate:沒有實體內部類的默認構造函數
我使用一個名爲Tynamo的CRUD框架,它依次依賴於Apache Tapestry和Hibernate。這一切都正常工作,除了當我嘗試將它用於具有複合/複合主鍵的表上的CRUD時。
我決定不走@EmbeddedId
路線,因爲它似乎根本不適用於該框架。這就是說,我一直在使用@IdClass
方法,這主要是工作;我認爲我是成功的一兩行代碼。
問題在於,當它開始使用反射來構建對象時,即使確實存在該內部類的公共空構造函數,它也會爆炸並說org.hibernate.InstantiationException: No default constructor for entity: ...
。
回答時,請避開代碼片段,並使用完整的類等,以便訪問此主題的其他人可以更全面地瞭解正在發生的事情。
你可以看到我的類下面:
package com.company.crud.entities;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import com.company.crud.entities.TransferExtension.TransferExtensionPK;
@Entity(name = "Transfer_Extensions")
@IdClass(TransferExtensionPK.class)
public class TransferExtension implements Serializable {
private static final long serialVersionUID = 1L;
@Id
// @NotNull(message = "Please supply a Script Code")
// @Length(min = 3, max = 4)
@Column(name = "Division", nullable = false)
private String scriptCode;
@Id
// @NotNull(message = "Please supply a Transfer Type")
// @Length(min = 3, max = 6)
@Column(name = "Transfer_Type", nullable = false)
private String transferType;
@Column(name = "Extension", nullable = true)
private String englishExtension;
@Column(name = "Span_Extension", nullable = true)
private String spanishExtension;
@Column(name = "Call_Type", nullable = true)
private String callType;
@Column(name = "Call_Center", nullable = true)
private String callCenter;
public TransferExtension() {
}
public TransferExtension(String scriptCode, String transferType,
String englishExtension, String spanishExtension, String callType,
String callCenter) {
this.callCenter = callCenter;
this.callType = callType;
this.englishExtension = englishExtension;
this.scriptCode = scriptCode;
this.spanishExtension = spanishExtension;
this.transferType = transferType;
}
public String getScriptCode() {
return this.scriptCode;
}
public void setScriptCode(String scriptCode) {
this.scriptCode = scriptCode;
}
public String getTransferType() {
return this.transferType;
}
public void setTransferType(String transferType) {
this.transferType = transferType;
}
public String getEnglishExtension() {
return this.englishExtension;
}
public void setEnglishExtension(String englishExtension) {
this.englishExtension = englishExtension;
}
public String getSpanishExtension() {
return this.spanishExtension;
}
public void setSpanishExtension(String spanishExtension) {
this.spanishExtension = spanishExtension;
}
public String getCallType() {
return this.callType;
}
public void setCallType(String callType) {
this.callType = callType;
}
public String getCallCenter() {
return this.callCenter;
}
public void setCallCenter(String callCenter) {
this.callCenter = callCenter;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("TransferExtension [scriptCode=")
.append(this.scriptCode).append(", transferType=")
.append(this.transferType).append(", englishExtension=")
.append(this.englishExtension).append(", spanishExtension=")
.append(this.spanishExtension).append(", callType=")
.append(this.callType).append(", callCenter=")
.append(this.callCenter).append("]");
return builder.toString();
}
public class TransferExtensionPK implements Serializable {
private static final long serialVersionUID = 4L;
private String scriptCode;
private String transferType;
public TransferExtensionPK() {
}
public TransferExtensionPK(String scriptCode, String transferType) {
this.scriptCode = scriptCode;
this.transferType = transferType;
}
public String getScriptCode() {
return this.scriptCode;
}
public void setScriptCode(String scriptCode) {
this.scriptCode = scriptCode;
}
public String getTransferType() {
return this.transferType;
}
public void setTransferType(String transferType) {
this.transferType = transferType;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("TransferExtensionPK [scriptCode=")
.append(this.scriptCode).append(", transferType=")
.append(this.transferType).append("]");
return builder.toString();
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + getOuterType().hashCode();
result = prime
* result
+ ((this.scriptCode == null) ? 0 : this.scriptCode
.hashCode());
result = prime
* result
+ ((this.transferType == null) ? 0 : this.transferType
.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof TransferExtensionPK)) {
return false;
}
TransferExtensionPK other = (TransferExtensionPK) obj;
if (!getOuterType().equals(other.getOuterType())) {
return false;
}
if (this.scriptCode == null) {
if (other.scriptCode != null) {
return false;
}
} else if (!this.scriptCode.equals(other.scriptCode)) {
return false;
}
if (this.transferType == null) {
if (other.transferType != null) {
return false;
}
} else if (!this.transferType.equals(other.transferType)) {
return false;
}
return true;
}
private TransferExtension getOuterType() {
return TransferExtension.this;
}
}
}
堆棧跟蹤:
Hibernate:
select
count(*) as y0_
from
Transfer_Extensions this_
Hibernate:
select
top 25 this_.Division as Division1_0_,
this_.Transfer_Type as Transfer2_1_0_,
this_.Call_Center as Call3_1_0_,
this_.Call_Type as Call4_1_0_,
this_.Extension as Extension1_0_,
this_.Span_Extension as Span6_1_0_
from
Transfer_Extensions this_
[ERROR] pages.List Render queue error in SetupRender[List:grid]: No default constructor for entity: com.company.crud.entities.TransferExtension$TransferExtensionPK
org.apache.tapestry5.ioc.internal.util.TapestryException: No default constructor for entity: com.company.crud.entities.TransferExtension$TransferExtensionPK [at context:List.tml, line 12]
at org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.invoke(ComponentPageElementImpl.java:158)
at org.apache.tapestry5.internal.structure.ComponentPageElementImpl$SetupRenderPhase.render(ComponentPageElementImpl.java:186)
at org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:72)
at org.apache.tapestry5.internal.services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:124)
at $PageRenderQueue_f31f9af2bde.render(Unknown Source)
at $PageRenderQueue_f31f9af2bdd.render(Unknown Source)
at org.apache.tapestry5.internal.services.MarkupRendererTerminator.renderMarkup(MarkupRendererTerminator.java:37)
at org.apache.tapestry5.services.TapestryModule$31.renderMarkup(TapestryModule.java:1994)
at $MarkupRenderer_f31f9af2be1.renderMarkup(Unknown Source)
at org.apache.tapestry5.services.TapestryModule$30.renderMarkup(TapestryModule.java:1978)
at $MarkupRenderer_f31f9af2be1.renderMarkup(Unknown Source)
at org.apache.tapestry5.services.TapestryModule$29.renderMarkup(TapestryModule.java:1960)
at $MarkupRenderer_f31f9af2be1.renderMarkup(Unknown Source)
at org.apache.tapestry5.services.TapestryModule$28.renderMarkup(TapestryModule.java:1945)
at $MarkupRenderer_f31f9af2be1.renderMarkup(Unknown Source)
at org.apache.tapestry5.services.TapestryModule$27.renderMarkup(TapestryModule.java:1931)
at $MarkupRenderer_f31f9af2be1.renderMarkup(Unknown Source)
at org.apache.tapestry5.services.TapestryModule$26.renderMarkup(TapestryModule.java:1913)
at $MarkupRenderer_f31f9af2be1.renderMarkup(Unknown Source)
at org.apache.tapestry5.services.TapestryModule$25.renderMarkup(TapestryModule.java:1894)
at $MarkupRenderer_f31f9af2be1.renderMarkup(Unknown Source)
at $MarkupRenderer_f31f9af2bdc.renderMarkup(Unknown Source)
at org.apache.tapestry5.internal.services.PageMarkupRendererImpl.renderPageMarkup(PageMarkupRendererImpl.java:47)
at $PageMarkupRenderer_f31f9af2bd5.renderPageMarkup(Unknown Source)
at org.apache.tapestry5.internal.services.PageResponseRendererImpl.renderPageResponse(PageResponseRendererImpl.java:67)
at $PageResponseRenderer_f31f9af2bd7.advised$renderPageResponse_f31f9af2bd9(Unknown Source)
at $PageResponseRenderer_f31f9af2bd7$Invocation_renderPageResponse_f31f9af2bd8.proceedToAdvisedMethod(Unknown Source)
at org.apache.tapestry5.internal.plastic.AbstractMethodInvocation.proceed(AbstractMethodInvocation.java:84)
at org.tynamo.services.TynamoCoreModule$2.advise(TynamoCoreModule.java:353)
at org.apache.tapestry5.internal.plastic.AbstractMethodInvocation.proceed(AbstractMethodInvocation.java:86)
at $PageResponseRenderer_f31f9af2bd7.renderPageResponse(Unknown Source)
at $PageResponseRenderer_f31f9af2bd0.renderPageResponse(Unknown Source)
at org.apache.tapestry5.internal.services.PageRenderRequestHandlerImpl.handle(PageRenderRequestHandlerImpl.java:64)
at org.apache.tapestry5.services.TapestryModule$38.handle(TapestryModule.java:2222)
at $PageRenderRequestHandler_f31f9af2bd2.handle(Unknown Source)
at $PageRenderRequestHandler_f31f9af2bcd.handle(Unknown Source)
at org.apache.tapestry5.internal.services.ComponentRequestHandlerTerminator.handlePageRender(ComponentRequestHandlerTerminator.java:48)
at org.apache.tapestry5.services.InitializeActivePageName.handlePageRender(InitializeActivePageName.java:47)
at $ComponentRequestHandler_f31f9af2bce.handlePageRender(Unknown Source)
at $ComponentRequestHandler_f31f9af2ac7.handlePageRender(Unknown Source)
at org.tynamo.routing.services.RouterDispatcher.dispatch(RouterDispatcher.java:26)
at $Dispatcher_f31f9af2acb.dispatch(Unknown Source)
at $Dispatcher_f31f9af2ac4.dispatch(Unknown Source)
at org.apache.tapestry5.services.TapestryModule$RequestHandlerTerminator.service(TapestryModule.java:302)
at org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26)
at $RequestHandler_f31f9af2ac5.service(Unknown Source)
at org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:902)
at $RequestHandler_f31f9af2ac5.service(Unknown Source)
at org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:892)
at $RequestHandler_f31f9af2ac5.service(Unknown Source)
at org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:90)
at $RequestHandler_f31f9af2ac5.service(Unknown Source)
at org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:105)
at org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:95)
at org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:85)
at org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:119)
at $RequestHandler_f31f9af2ac5.service(Unknown Source)
at $RequestHandler_f31f9af2ab9.service(Unknown Source)
at org.apache.tapestry5.services.TapestryModule$HttpServletRequestHandlerTerminator.service(TapestryModule.java:253)
at org.apache.tapestry5.internal.gzip.GZipFilter.service(GZipFilter.java:53)
at $HttpServletRequestHandler_f31f9af2abb.service(Unknown Source)
at org.apache.tapestry5.upload.internal.services.MultipartServletRequestFilter.service(MultipartServletRequestFilter.java:44)
at $HttpServletRequestHandler_f31f9af2abb.service(Unknown Source)
at org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)
at $HttpServletRequestFilter_f31f9af2ab7.service(Unknown Source)
at $HttpServletRequestHandler_f31f9af2abb.service(Unknown Source)
at org.apache.tapestry5.services.TapestryModule$1.service(TapestryModule.java:852)
at $HttpServletRequestHandler_f31f9af2abb.service(Unknown Source)
at $HttpServletRequestHandler_f31f9af2ab5.service(Unknown Source)
at org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:171)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1476)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:501)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.Server.handle(Server.java:370)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)
at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:971)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1033)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:644)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:696)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:53)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
at java.lang.Thread.run(Thread.java:744)
Caused by: org.hibernate.InstantiationException: No default constructor for entity: com.company.crud.entities.TransferExtension$TransferExtensionPK
at org.hibernate.tuple.PojoInstantiator.instantiate(PojoInstantiator.java:107)
at org.hibernate.tuple.component.AbstractComponentTuplizer.instantiate(AbstractComponentTuplizer.java:102)
at org.hibernate.type.ComponentType.instantiate(ComponentType.java:511)
at org.hibernate.type.ComponentType.instantiate(ComponentType.java:517)
at org.hibernate.type.EmbeddedComponentType.instantiate(EmbeddedComponentType.java:59)
at org.hibernate.type.ComponentType.resolve(ComponentType.java:609)
at org.hibernate.loader.Loader.extractKeysFromResultSet(Loader.java:722)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:606)
at org.hibernate.loader.Loader.doQuery(Loader.java:829)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
at org.hibernate.loader.Loader.doList(Loader.java:2533)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
at org.hibernate.loader.Loader.list(Loader.java:2271)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:119)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1716)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:347)
at org.tynamo.hibernate.services.HibernatePersistenceServiceImpl.getInstances(HibernatePersistenceServiceImpl.java:349)
at org.tynamo.hibernate.services.HibernatePersistenceServiceImpl.getInstances(HibernatePersistenceServiceImpl.java:333)
at org.tynamo.hibernate.services.HibernatePersistenceServiceImpl.getInstances(HibernatePersistenceServiceImpl.java:172)
at $HibernatePersistenceService_f31f9af2bf1.getInstances(Unknown Source)
at $HibernatePersistenceService_f31f9af2b41.getInstances(Unknown Source)
at org.tynamo.TynamoGridDataSource.prepare(TynamoGridDataSource.java:58)
at org.apache.tapestry5.corelib.components.Grid$CachingDataSource.prepare(Grid.java:313)
at org.apache.tapestry5.corelib.components.Grid.setupDataSource(Grid.java:483)
at org.apache.tapestry5.corelib.components.Grid.setupRender(Grid.java:447)
at org.apache.tapestry5.corelib.components.Grid.setupRender(Grid.java)
at org.apache.tapestry5.internal.structure.ComponentPageElementImpl$SetupRenderPhase.invokeComponent(ComponentPageElementImpl.java:179)
at org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.invoke(ComponentPageElementImpl.java:148)
... 94 more
[INFO] InternalModule.PageResponseRenderer discarding all List page persistent field changes due to a RenderQueueException
[ERROR] TapestryModule.RequestExceptionHandler Processing of request failed with uncaught exception: Render queue error in SetupRender[List:grid]: No default constructor for entity: com.company.crud.entities.TransferExtension$TransferExtensionPK
org.apache.tapestry5.internal.services.RenderQueueException: Render queue error in SetupRender[List:grid]: No default constructor for entity: com.company.crud.entities.TransferExtension$TransferExtensionPK [at context:List.tml, line 12]
at org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:81)
at org.apache.tapestry5.internal.services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:124)
at $PageRenderQueue_f31f9af2bde.render(Unknown Source)
at $PageRenderQueue_f31f9af2bdd.render(Unknown Source)
at org.apache.tapestry5.internal.services.MarkupRendererTerminator.renderMarkup(MarkupRendererTerminator.java:37)
at org.apache.tapestry5.services.TapestryModule$31.renderMarkup(TapestryModule.java:1994)
at $MarkupRenderer_f31f9af2be1.renderMarkup(Unknown Source)
at org.apache.tapestry5.services.TapestryModule$30.renderMarkup(TapestryModule.java:1978)
at $MarkupRenderer_f31f9af2be1.renderMarkup(Unknown Source)
at org.apache.tapestry5.services.TapestryModule$29.renderMarkup(TapestryModule.java:1960)
at $MarkupRenderer_f31f9af2be1.renderMarkup(Unknown Source)
at org.apache.tapestry5.services.TapestryModule$28.renderMarkup(TapestryModule.java:1945)
at $MarkupRenderer_f31f9af2be1.renderMarkup(Unknown Source)
at org.apache.tapestry5.services.TapestryModule$27.renderMarkup(TapestryModule.java:1931)
at $MarkupRenderer_f31f9af2be1.renderMarkup(Unknown Source)
at org.apache.tapestry5.services.TapestryModule$26.renderMarkup(TapestryModule.java:1913)
at $MarkupRenderer_f31f9af2be1.renderMarkup(Unknown Source)
at org.apache.tapestry5.services.TapestryModule$25.renderMarkup(TapestryModule.java:1894)
at $MarkupRenderer_f31f9af2be1.renderMarkup(Unknown Source)
at $MarkupRenderer_f31f9af2bdc.renderMarkup(Unknown Source)
at org.apache.tapestry5.internal.services.PageMarkupRendererImpl.renderPageMarkup(PageMarkupRendererImpl.java:47)
at $PageMarkupRenderer_f31f9af2bd5.renderPageMarkup(Unknown Source)
at org.apache.tapestry5.internal.services.PageResponseRendererImpl.renderPageResponse(PageResponseRendererImpl.java:67)
at $PageResponseRenderer_f31f9af2bd7.advised$renderPageResponse_f31f9af2bd9(Unknown Source)
at $PageResponseRenderer_f31f9af2bd7$Invocation_renderPageResponse_f31f9af2bd8.proceedToAdvisedMethod(Unknown Source)
at org.apache.tapestry5.internal.plastic.AbstractMethodInvocation.proceed(AbstractMethodInvocation.java:84)
at org.tynamo.services.TynamoCoreModule$2.advise(TynamoCoreModule.java:353)
at org.apache.tapestry5.internal.plastic.AbstractMethodInvocation.proceed(AbstractMethodInvocation.java:86)
at $PageResponseRenderer_f31f9af2bd7.renderPageResponse(Unknown Source)
at $PageResponseRenderer_f31f9af2bd0.renderPageResponse(Unknown Source)
at org.apache.tapestry5.internal.services.PageRenderRequestHandlerImpl.handle(PageRenderRequestHandlerImpl.java:64)
at org.apache.tapestry5.services.TapestryModule$38.handle(TapestryModule.java:2222)
at $PageRenderRequestHandler_f31f9af2bd2.handle(Unknown Source)
at $PageRenderRequestHandler_f31f9af2bcd.handle(Unknown Source)
at org.apache.tapestry5.internal.services.ComponentRequestHandlerTerminator.handlePageRender(ComponentRequestHandlerTerminator.java:48)
at org.apache.tapestry5.services.InitializeActivePageName.handlePageRender(InitializeActivePageName.java:47)
at $ComponentRequestHandler_f31f9af2bce.handlePageRender(Unknown Source)
at $ComponentRequestHandler_f31f9af2ac7.handlePageRender(Unknown Source)
at org.tynamo.routing.services.RouterDispatcher.dispatch(RouterDispatcher.java:26)
at $Dispatcher_f31f9af2acb.dispatch(Unknown Source)
at $Dispatcher_f31f9af2ac4.dispatch(Unknown Source)
at org.apache.tapestry5.services.TapestryModule$RequestHandlerTerminator.service(TapestryModule.java:302)
at org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26)
at $RequestHandler_f31f9af2ac5.service(Unknown Source)
at org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:902)
at $RequestHandler_f31f9af2ac5.service(Unknown Source)
at org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:892)
at $RequestHandler_f31f9af2ac5.service(Unknown Source)
at org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:90)
at $RequestHandler_f31f9af2ac5.service(Unknown Source)
at org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:105)
at org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:95)
at org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:85)
at org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:119)
at $RequestHandler_f31f9af2ac5.service(Unknown Source)
at $RequestHandler_f31f9af2ab9.service(Unknown Source)
at org.apache.tapestry5.services.TapestryModule$HttpServletRequestHandlerTerminator.service(TapestryModule.java:253)
at org.apache.tapestry5.internal.gzip.GZipFilter.service(GZipFilter.java:53)
at $HttpServletRequestHandler_f31f9af2abb.service(Unknown Source)
at org.apache.tapestry5.upload.internal.services.MultipartServletRequestFilter.service(MultipartServletRequestFilter.java:44)
at $HttpServletRequestHandler_f31f9af2abb.service(Unknown Source)
at org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)
at $HttpServletRequestFilter_f31f9af2ab7.service(Unknown Source)
at $HttpServletRequestHandler_f31f9af2abb.service(Unknown Source)
at org.apache.tapestry5.services.TapestryModule$1.service(TapestryModule.java:852)
at $HttpServletRequestHandler_f31f9af2abb.service(Unknown Source)
at $HttpServletRequestHandler_f31f9af2ab5.service(Unknown Source)
at org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:171)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1476)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:501)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.Server.handle(Server.java:370)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)
at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:971)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1033)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:644)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:696)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:53)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
at java.lang.Thread.run(Thread.java:744)
Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException: No default constructor for entity: com.company.crud.entities.TransferExtension$TransferExtensionPK [at context:List.tml, line 12]
at org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.invoke(ComponentPageElementImpl.java:158)
at org.apache.tapestry5.internal.structure.ComponentPageElementImpl$SetupRenderPhase.render(ComponentPageElementImpl.java:186)
at org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:72)
... 92 more
Caused by: org.hibernate.InstantiationException: No default constructor for entity: com.company.crud.entities.TransferExtension$TransferExtensionPK
at org.hibernate.tuple.PojoInstantiator.instantiate(PojoInstantiator.java:107)
at org.hibernate.tuple.component.AbstractComponentTuplizer.instantiate(AbstractComponentTuplizer.java:102)
at org.hibernate.type.ComponentType.instantiate(ComponentType.java:511)
at org.hibernate.type.ComponentType.instantiate(ComponentType.java:517)
at org.hibernate.type.EmbeddedComponentType.instantiate(EmbeddedComponentType.java:59)
at org.hibernate.type.ComponentType.resolve(ComponentType.java:609)
at org.hibernate.loader.Loader.extractKeysFromResultSet(Loader.java:722)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:606)
at org.hibernate.loader.Loader.doQuery(Loader.java:829)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
at org.hibernate.loader.Loader.doList(Loader.java:2533)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
at org.hibernate.loader.Loader.list(Loader.java:2271)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:119)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1716)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:347)
at org.tynamo.hibernate.services.HibernatePersistenceServiceImpl.getInstances(HibernatePersistenceServiceImpl.java:349)
at org.tynamo.hibernate.services.HibernatePersistenceServiceImpl.getInstances(HibernatePersistenceServiceImpl.java:333)
at org.tynamo.hibernate.services.HibernatePersistenceServiceImpl.getInstances(HibernatePersistenceServiceImpl.java:172)
at $HibernatePersistenceService_f31f9af2bf1.getInstances(Unknown Source)
at $HibernatePersistenceService_f31f9af2b41.getInstances(Unknown Source)
at org.tynamo.TynamoGridDataSource.prepare(TynamoGridDataSource.java:58)
at org.apache.tapestry5.corelib.components.Grid$CachingDataSource.prepare(Grid.java:313)
at org.apache.tapestry5.corelib.components.Grid.setupDataSource(Grid.java:483)
at org.apache.tapestry5.corelib.components.Grid.setupRender(Grid.java:447)
at org.apache.tapestry5.corelib.components.Grid.setupRender(Grid.java)
at org.apache.tapestry5.internal.structure.ComponentPageElementImpl$SetupRenderPhase.invokeComponent(ComponentPageElementImpl.java:179)
at org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.invoke(ComponentPageElementImpl.java:148)
... 94 more
所以做我需要內部類移動到自己的類,或者我可以修改外類以某種方式實例化內部類沒有參數? – liltitus27 2015-01-20 19:08:28
將static關鍵字添加到內部類聲明 – gknicker 2015-01-20 19:08:52
需要注意的一點是,由於不再需要'getOuterType()'調用,所以需要重新生成'equals()'方法。正如我上面所提到的,通過將內部類移到它自己的包和/或類中,也可以實現相同的結果。 – liltitus27 2015-01-20 19:27:57