Hibernate: No default constructor for entity Inner Class
Asked Answered
A

1

14

I realize there are many similar questions, but none have helped me along on this.

I'm using a CRUD framework called Tynamo, which in turn relies on Apache Tapestry and Hibernate. This all works fine, except for when I try to use it for CRUD on a table with a composite/compound primary key.

I've decided not to go the @EmbeddedId route, since it seems to not work at all with the framework. That being said, I have been using the @IdClass method, which is mostly working; I think I'm a line or two of code away from success.

The issue is that when it starts using reflection to build the objects, it blows up and says, org.hibernate.InstantiationException: No default constructor for entity: ..., even though there is, indeed, a public, empty constructor for that inner class.

When answering, please avoid code snippets, and use full classes, etc. so that others visiting this thread can have a more complete picture of what's going on.

You can see my class below:

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;
        }
    }
}

Stack Trace:

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
Anisette answered 20/1, 2015 at 18:58 Comment(0)
E
25

Under the covers, TransferExtensionPK actually has no default constructor because it's an inner class. Inner classes require an instance of their outer class in order to be constructed, so the compiler has translated your no-parameter constructor into a one-parameter constructor which accepts an instance of TransferExtension.

To fix the problem, make TransferExtensionPK merely a nested class (static) rather than an inner class:

public static class TransferExtensionPK // etc
Emancipator answered 20/1, 2015 at 19:6 Comment(4)
so do i need to move the inner class into its own class, or can i modify the outer class to somehow instantiate the inner class with no args?Anisette
add static keyword to inner class declarationEmancipator
one thing to note is that the equals() method will need to be regenerated since the getOuterType() call will no longer be needed. as i posited above, it's also possible to achieve the same outcome by moving the inner class to its own package and/or class.Anisette
for those using tapesty and/or tynamo, i have posted a followup thread on an ensuing error at #28054074Anisette

© 2022 - 2024 — McMap. All rights reserved.