0

マップされていないクラスの例外が発生しますが、マップしていると思います。1対多の関係を持つClientApptsとAppointmentsの2つのクラスがあります。すべてのクライアントとその予約日を取得したいと思います。何が原因ですか?すべての提案を歓迎します。

クラスは次のとおりです。

@Entity(name="ClientAppts")
@Table(name="person")
public class ClientAppts {
private Integer person_id;
private String  fName;
private String  lName;
private Date    appt;
private String  phone;
private String  cell;

private String  address1;
private String  address2;
private String  city;
private String  state;
private String  zip;
private String  doctor;
private String  notes;

@ElementCollection
@CollectionTable(name="Appointment", joinColumns= @JoinColumn(name="person_id"))
@Column(name="appt")
Collection<Date> appointments;

    // various getters and setters follow.

そして、ここで、明確にするために、上記のAppointmentクラスがあります。

@Entity(name="Appointment")
@Table(name="appointment")

public class Appointment {
private int         id;
private Date        appt;
private Date        apptfinish;
private String      title;
private String      location;
private BigDecimal  fee;
private BigDecimal  amtPaid;
private Boolean     serviceRendered;
private int         person_id;
private String      description;

そして、これが例外をスローするコードです:

List<ClientAppts> list = getSessionFactory().getCurrentSession().createQuery(" from ClientAppts client order by client.lName ").list();

そして最後に、スタックトレース:

org.hibernate.hql.internal.ast.QuerySyntaxException:ClientApptsは、org.hibernate.hql.internal.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:180)で[ClientApptsクライアントの注文からclient.lNameによって]マップされません。 org.hibernate.hql.internal.ast.tree.FromClause.addFromElement(FromClause.java:93)at org.hibernate.hql.internal.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:110)at org.hibernate hql.internal.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:326)at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3252)at org.hibernate.hql.internal.antlr. fromElementList(HqlSqlBaseWalker.java:3141)at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:694)atorg.hibernate.hql.internal。antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:550)at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:287)at org.hibernate.hql.internal.antlr.HqlSqlBase java:235)at org.hibernate.hql.internal.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:248)at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:183)at org.hibernate .hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)at org.hibernate.engine.query.spi.HQLQueryPlan。(HQLQueryPlan.java:101)atorg.hibernate.engine.query.spi.HQLQueryPlan。 (HQLQueryPlan.java:80)org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:119)atorg.hibernate.internal.AbstractSessionImpl。getHQLQueryPlan(AbstractSessionImpl.java:215)at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:193)at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1649)at com.dave.user.dao .UserDAO.getClientAppts(UserDAO.java:130)at com.dave.user.service.UserService.getClientAppts(UserService.java:126)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)at java.lang.reflect.Method.invoke(Method.java:597)atorg.springframework.aop.support.AopUtils。 org.springframework.aop.framework.ReflectiveMethodInvocationでinvokeJoinpointUsingReflection(AopUtils.java:318)。invokeJoinpoint(ReflectiveMethodInvocation.java:183)at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)at org.springframework .aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)at $ Proxy251.getClientAppts(Unknown Source)atcom.dave.managed。 bean.AppointmentsMB.loadAppointments(AppointmentsMB.java:45)at com.dave.managed.bean.AppointmentsMB.init(AppointmentsMB.java:40)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)atsun.reflect.NativeMethodAccessorImpl。太陽でinvoke(NativeMethodAccessorImpl.java:39)。org.glassfish.faces.integration.GlassFishInjectionProvider $ 2.run(GlassFishInjectionProvider.java:382)のjava.lang.reflect.Method.invoke(Method.java:597)のreflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.security.AccessController.doPrivileged(Native Method)at org.glassfish.faces.integration.GlassFishInjectionProvider.invokeLifecycleMethod(GlassFishInjectionProvider.java:376)at org.glassfish.faces.integration.GlassFishInjectionProvider.invokePostConstruct(GlassFishInject org.glassfish.faces.integration.GlassFishInjectionProvider.invokePostConstruct(GlassFishInjectionProvider.java:229)at com.sun.faces.mgbean.BeanBuilder.invokePostConstruct(BeanBuilder.java:223)at com.sun.faces.mgbean.BeanBuilder.build( BeanBuilder.java:105)(com.sun.faces)。mgbean.BeanManager.createAndPush(BeanManager.java:409)at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:269)at com.sun.faces.el.ManagedBeanELResolver.resolveBean(ManagedBeanELResolver.java:244) com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:116)at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)at com.sun.faces.el.DemuxCompositeELResolver.getValue (DemuxCompositeELResolver.java:203)at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:103)at com.sun.el.parser.AstValue.getValue(AstValue.java:179)atcom.sun。 el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:224)at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)atjavax.faces.component.ComponentStateHelper。eval(ComponentStateHelper.java:194)at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182)at javax.faces.component.UIOutput.getValue(UIOutput.java:169)at org.primefaces.component.calendar .CalendarUtils.getValueAsString(CalendarUtils.java:35)at org.primefaces.component.calendar.CalendarRenderer.encodeEnd(CalendarRenderer.java:58)at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)atcom。 sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:312)at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:105)at javax.faces.component.UIComponentBase.encodeChildren( UIComponentBase.java:845)at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:304)atcom。sun.faces.renderkit.html_basic.GridRenderer.renderRow(GridRenderer.java:185)at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:129)at javax.faces.component.UIComponentBase.encodeChildren( UIComponentBase.java:845)at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1757)at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)at javax.faces.component.UIComponentBase.encodeChildren (UIComponentBase.java:845)at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1757)at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1760)atjavax.faces.component.UIComponent。 encodeAll(UIComponent.java:1760)at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1760)atcom.sun.faces.application.view.FaceletViewHandlingStrategy。org.apacheのjavax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)のcom.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)のrenderView(FaceletViewHandlingStrategy.java:402) .myfaces.tomahawk.application.ResourceViewHandlerWrapper.renderView(ResourceViewHandlerWrapper.java:93)at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)at com.sun.faces.lifecycle.Phase.doPhase(Phase .java:101)at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)atorg.apache.catalina.core。 StandardWrapper.service(StandardWrapper.java:1542)at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)atorg.apache.catalina.core。StandardContextValve.invoke(StandardContextValve.java:175)at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)at org .apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter .java:231)at com.sun.enterprise.v3.services.impl.ContainerMapper $ AdapterCallable.call(ContainerMapper.java:317)at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java :195)com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)atcom.sun.grizzly。http.ProcessorTask.process(ProcessorTask.java:1045)at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)at com .sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79 )com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)at com.sun.grizzly.ContextTask.run(ContextTask.java: 71)com.sun.grizzly.util.AbstractThreadPool $ Worker.doWork(AbstractThreadPool.java:532)atcom.sun.grizzly.util。AbstractThreadPool $ Worker.run(AbstractThreadPool.java:513)at java.lang.Thread.run(Thread.java:662)

4

1 に答える 1

0

この関係マッピングを試してください:

public class ClientAppts {
...

@OneToMany(mappedBy = "clientAppt", fetch = FetchType.LAZY, trgetEntity = Appointment.class)
private Collection<Date> appointments;
...
}

public class Appointment {
...

@ManyToOne
private ClientAppts clientAppt;
...
}
于 2012-09-20T04:21:35.473 に答える