我意识到有许多类似的问题,但没有人帮助我。
我正在使用一个名为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
答案 0 :(得分:17)
在幕后,TransferExtensionPK
实际上没有默认构造函数,因为它是一个内部类。内部类需要其外部类的实例才能构造,因此编译器已将无参数构造函数转换为单参数构造函数,该构造函数接受TransferExtension
的实例。
要解决此问题,请将TransferExtensionPK
仅仅设为嵌套类(静态)而不是内部类:
public static class TransferExtensionPK // etc