0

Eventclassと、 classHazardSubmissionを拡張する classの 2 つのクラスがありEventます。

クラスには、 with 、および;Eventプロパティがあります。dateCreatedgetDateCreated()setDateCreated(String)

私がしようとすると:

HazardSubmission hs = new HazardSubmission();
hs.setDateCreated("A");

クラス n でセッターを呼び出すと想定していましたが、クラスnEventでセッターを探しています。HazardSubmissio

ここにエラーがあります。助けていただければ幸いです。:)

SEVERE: Servlet.service() for servlet DispatcherServlet threw exception
org.hibernate.PropertyNotFoundException: Could not find a setter for property dateCreated in class nz.co.company.healthsafety.stripes.model.HazardSubmission
    at org.hibernate.property.BasicPropertyAccessor.createSetter(BasicPropertyAccessor.java:240)
    at org.hibernate.property.BasicPropertyAccessor.getSetter(BasicPropertyAccessor.java:233)
    at org.hibernate.mapping.Property.getSetter(Property.java:299)
    at org.hibernate.tuple.entity.PojoEntityTuplizer.buildPropertySetter(PojoEntityTuplizer.java:307)
    at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:142)
    at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:78)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:107)
    at org.hibernate.tuple.entity.EntityTuplizerFactory.constructDefaultTuplizer(EntityTuplizerFactory.java:135)
    at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.<init>(EntityEntityModeToTuplizerMapping.java:80)
    at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:323)
    at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:456)
    at org.hibernate.persister.entity.JoinedSubclassEntityPersister.<init>(JoinedSubclassEntityPersister.java:113)
    at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:87)
    at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:267)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1341)
    at nz.co.company.healthsafety.stripes.action.BaseController.<clinit>(BaseController.java:36)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at java.lang.Class.newInstance0(Class.java:355)
    at java.lang.Class.newInstance(Class.java:308)
    at net.sourceforge.stripes.controller.AnnotatedClassActionResolver.makeNewActionBean(AnnotatedClassActionResolver.java:432)
    at net.sourceforge.stripes.controller.AnnotatedClassActionResolver.getActionBean(AnnotatedClassActionResolver.java:360)
    at net.sourceforge.stripes.controller.NameBasedActionResolver.getActionBean(NameBasedActionResolver.java:264)
    at net.sourceforge.stripes.controller.AnnotatedClassActionResolver.getActionBean(AnnotatedClassActionResolver.java:293)
    at net.sourceforge.stripes.controller.DispatcherHelper$1.intercept(DispatcherHelper.java:106)
    at net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:158)
    at net.sourceforge.stripes.controller.BeforeAfterMethodInterceptor.intercept(BeforeAfterMethodInterceptor.java:113)
    at net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:155)
    at net.sourceforge.stripes.controller.ExecutionContext.wrap(ExecutionContext.java:74)
    at net.sourceforge.stripes.controller.DispatcherHelper.resolveActionBean(DispatcherHelper.java:102)
    at net.sourceforge.stripes.controller.DispatcherServlet.resolveActionBean(DispatcherServlet.java:238)
    at net.sourceforge.stripes.controller.DispatcherServlet.service(DispatcherServlet.java:141)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at net.sourceforge.stripes.controller.StripesFilter.doFilter(StripesFilter.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Thread.java:619)
5/04/2012 4:34:42 PM net.sourceforge.stripes.util.Log warn

私のマッピングxmlの簡素化:

<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
    <class name="nz.co.company.healthsafety.stripes.model.Event" table="events">
        <id name="id"  type="java.lang.Integer" column="id">
            <generator class="native" />
        </id>
        <property name="dateCreated" column="dateCreated" type="timestamp" not-null="true" length="200" />

        <joined-subclass name="nz.co.company.healthsafety.stripes.model.HazardSubmission" table="hazard_submissions">
            <key column="id" />
            <property name="reporterFirstName" column="reporterFirstName" type="java.lang.String" not-null="true" length="200" />
            <property name="reporterLastName" column="reporterLastName" type="java.lang.String" not-null="true" length="200" />

        </joined-subclass>

    </class>
</hibernate-mapping>
4

1 に答える 1

2

作成日は XML によるタイム スタンプである必要がありますが、プロパティを文字列として宣言しているようです。

これらのタイプのいずれかを一致するように変更できますか?

于 2012-04-05T06:10:12.983 に答える