Boa tarde galera… estou com um problema q ta me dando dor de cabeça
tenho 3 tabelas uma ordem de serviço, tipoDeServico, e itensDeServico. Não estou conseguindo fazer o relacionamento entre elas alguem pode me dar uma mão veh onde estou errando
[code]@Entity
public class OrdemDeServico {
@Id
@GeneratedValue
private Integer idOrdemDeServico;
private String dataAbertura;
private String Status;
private String obs;
private Float valorTotal;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "ordemDeServico", fetch = FetchType.EAGER)
private Collection<ItensDeServico> itensDeServico;
@OneToOne(cascade = javax.persistence.CascadeType.PERSIST)
@JoinColumn(name = "id_pessoa")
@Fetch(FetchMode.JOIN)
private Pessoa pessoa;
@OneToOne(cascade = javax.persistence.CascadeType.PERSIST)
@JoinColumn(name = "id_funcionario")
@Fetch(FetchMode.JOIN)
private Funcionario funcionario;
GUETTER AND SETTERS[/code]
[code]@Entity
public class ItensDeServico {
@Id
@GeneratedValue
private Integer idItensDeServico;
@OneToMany(cascade = javax.persistence.CascadeType.PERSIST)
@JoinColumn(name = "id_tipoDeServico")
@Fetch(FetchMode.JOIN)
private Collection<TipoDeServico> tiposDeServico;
GUETTERS AND SETTERS
[/code]
[code]@Entity
public class TipoDeServico {
@Id
@GeneratedValue
private Integer idTipoDeServico;
private Float valor;
private String descricao;
GUETTERS AND SETTERS[/code]
O ERRO
[code]Caused by: org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: br.com.projeto.beans.ItensDeServico.ordemDeServico in br.com.projeto.beans.OrdemDeServico.itensDeServico
at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:655)
at org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:619)
at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:66)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1221)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:383)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1377)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:954)
at br.com.projeto.util.HibernateUtil.(HibernateUtil.java:17)
… 51 more
Nov 11, 2011 10:45:53 AM org.apache.catalina.core.StandardWrapperValve invoke
Grave: Servlet.service() for servlet [Faces Servlet] in context with path [/Projeto_Faculdade] threw exception [null] with root cause
org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: br.com.projeto.beans.ItensDeServico.ordemDeServico in br.com.projeto.beans.OrdemDeServico.itensDeServico
at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:655)
at org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:619)
at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:66)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1221)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:383)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1377)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:954)
at br.com.projeto.util.HibernateUtil.(HibernateUtil.java:17)
at br.com.projeto.dao.HibernateDao.getBeans(HibernateDao.java:47)
at br.com.projeto.controller.TipoDeServicoBean.getListTipoDeServico(TipoDeServicoBean.java:52)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at javax.el.BeanELResolver.getValue(BeanELResolver.java:87)
at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
at org.apache.el.parser.AstValue.getValue(AstValue.java:169)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189)
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:193)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:181)
at javax.faces.component.UIData.getValue(UIData.java:557)
at org.primefaces.component.datatable.DataTable.getValue(DataTable.java:808)
at javax.faces.component.UIData.getDataModel(UIData.java:1297)
at javax.faces.component.UIData.getRowCount(UIData.java:342)
at org.primefaces.component.datatable.DataTableRenderer.encodeTbody(DataTableRenderer.java:448)
at org.primefaces.component.datatable.DataTableRenderer.encodeRegularTable(DataTableRenderer.java:194)
at org.primefaces.component.datatable.DataTableRenderer.encodeMarkup(DataTableRenderer.java:173)
at org.primefaces.component.datatable.DataTableRenderer.encodeEnd(DataTableRenderer.java:79)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:883)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1659)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:853)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1652)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1655)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1655)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:399)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
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:509)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:185)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:151)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:269)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)[/code]
GRATO DESDE JA