maxguzenski 1 de set. de 2006
Seus metodos equals() e hashCode() na classe FuncionariosProgramas estão implementados erroneamente (ou nao existem)
diego.mendes 1 de set. de 2006
E como eu faria pra implementar?
Um método normal que recebe collections e tal?
diego.mendes 1 de set. de 2006
cara implementei o equals no Bean e continua dando o erro… =[
Mauricio_Linhares 1 de set. de 2006
O problema não é o equals ou o hashCode implementados incorretamente, é a falta de integridade referêncial do seu banco que aceitou dois objetos com a mesma chave primária.
diego.mendes 1 de set. de 2006
então…eu declarei o hbm dessa forma
<hibernate-mapping>
<class name= "BO.Acesso.FuncionariosProgramas" table= "funcionario_programas" >
<composite-id>
<key-many-to-one name= "codigoFuncionario" />
<key-many-to-one name= "codigoPrograma" />
</composite-id>
</class>
</hibernate-mapping>
deu dae os seguintes problemas no começo…nem consigo abrir a aplicação…
2 [ http-8080-Processor25 ] ERROR cfg . Configuration - Could not compile the mapping document
net . sf . hibernate . MappingException : duplicate import : FuncionariosProgramas
at net . sf . hibernate . cfg . Mappings . addImport ( Mappings . java : 85 )
at net . sf . hibernate . cfg . Binder . bindClass ( Binder . java : 126 )
at net . sf . hibernate . cfg . Binder . bindRootClass ( Binder . java : 221 )
at net . sf . hibernate . cfg . Binder . bindRoot ( Binder . java : 1229 )
at net . sf . hibernate . cfg . Configuration . add ( Configuration . java : 249 )
at net . sf . hibernate . cfg . Configuration . addInputStream ( Configuration . java : 285 )
at net . sf . hibernate . cfg . Configuration . addResource ( Configuration . java : 315 )
at net . sf . hibernate . cfg . Configuration . doConfigure ( Configuration . java : 976 )
at net . sf . hibernate . cfg . Configuration . doConfigure ( Configuration . java : 928 )
at net . sf . hibernate . cfg . Configuration . configure ( Configuration . java : 856 )
at net . sf . hibernate . cfg . Configuration . configure ( Configuration . java : 842 )
at marcol . lib . HibernateUtil . < clinit > ( HibernateUtil . java : 39 )
at marcol . struts . action . LoginAction . execute ( LoginAction . java : 69 )
at org . apache . struts . action . RequestProcessor . processActionPerform ( RequestProcessor . java : 484 )
at org . apache . struts . action . RequestProcessor . process ( RequestProcessor . java : 274 )
at org . apache . struts . action . ActionServlet . process ( ActionServlet . java : 1482 )
at org . apache . struts . action . ActionServlet . doGet ( ActionServlet . java : 507 )
at javax . servlet . http . HttpServlet . service ( HttpServlet . java : 689 )
at javax . servlet . http . HttpServlet . service ( HttpServlet . java : 802 )
at org . apache . catalina . core . ApplicationFilterChain . internalDoFilter ( ApplicationFilterChain . java : 252 )
at org . apache . catalina . core . ApplicationFilterChain . doFilter ( ApplicationFilterChain . java : 173 )
at org . apache . catalina . core . StandardWrapperValve . invoke ( StandardWrapperValve . java : 213 )
at org . apache . catalina . core . StandardContextValve . invoke ( StandardContextValve . java : 178 )
at org . apache . catalina . core . StandardHostValve . invoke ( StandardHostValve . java : 126 )
at org . apache . catalina . valves . ErrorReportValve . invoke ( ErrorReportValve . java : 105 )
at org . apache . catalina . core . StandardEngineValve . invoke ( StandardEngineValve . java : 107 )
at org . apache . catalina . connector . CoyoteAdapter . service ( CoyoteAdapter . java : 148 )
at org . apache . coyote . http11 . Http11Processor . process ( Http11Processor . java : 856 )
at org . apache . coyote . http11 . Http11Protocol $ Http11ConnectionHandler . processConnection ( Http11Protocol . java : 744 )
at org . apache . tomcat . util . net . PoolTcpEndpoint . processSocket ( PoolTcpEndpoint . java : 527 )
at org . apache . tomcat . util . net . LeaderFollowerWorkerThread . runIt ( LeaderFollowerWorkerThread . java : 80 )
at org . apache . tomcat . util . threads . ThreadPool $ ControlRunnable . run ( ThreadPool . java : 684 )
at java . lang . Thread . run ( Unknown Source )
32 [ http-8080-Processor25 ] ERROR [ /freesmb ] . [ action ] - Servlet . service () for servlet action threw exception
java . lang . ExceptionInInitializerError
at marcol . struts . action . LoginAction . execute ( LoginAction . java : 69 )
at org . apache . struts . action . RequestProcessor . processActionPerform ( RequestProcessor . java : 484 )
at org . apache . struts . action . RequestProcessor . process ( RequestProcessor . java : 274 )
at org . apache . struts . action . ActionServlet . process ( ActionServlet . java : 1482 )
at org . apache . struts . action . ActionServlet . doGet ( ActionServlet . java : 507 )
at javax . servlet . http . HttpServlet . service ( HttpServlet . java : 689 )
at javax . servlet . http . HttpServlet . service ( HttpServlet . java : 802 )
at org . apache . catalina . core . ApplicationFilterChain . internalDoFilter ( ApplicationFilterChain . java : 252 )
at org . apache . catalina . core . ApplicationFilterChain . doFilter ( ApplicationFilterChain . java : 173 )
at org . apache . catalina . core . StandardWrapperValve . invoke ( StandardWrapperValve . java : 213 )
at org . apache . catalina . core . StandardContextValve . invoke ( StandardContextValve . java : 178 )
at org . apache . catalina . core . StandardHostValve . invoke ( StandardHostValve . java : 126 )
at org . apache . catalina . valves . ErrorReportValve . invoke ( ErrorReportValve . java : 105 )
at org . apache . catalina . core . StandardEngineValve . invoke ( StandardEngineValve . java : 107 )
at org . apache . catalina . connector . CoyoteAdapter . service ( CoyoteAdapter . java : 148 )
at org . apache . coyote . http11 . Http11Processor . process ( Http11Processor . java : 856 )
at org . apache . coyote . http11 . Http11Protocol $ Http11ConnectionHandler . processConnection ( Http11Protocol . java : 744 )
at org . apache . tomcat . util . net . PoolTcpEndpoint . processSocket ( PoolTcpEndpoint . java : 527 )
at org . apache . tomcat . util . net . LeaderFollowerWorkerThread . runIt ( LeaderFollowerWorkerThread . java : 80 )
at org . apache . tomcat . util . threads . ThreadPool $ ControlRunnable . run ( ThreadPool . java : 684 )
at java . lang . Thread . run ( Unknown Source )
Caused by : java . lang . RuntimeException : Exception building SessionFactory : Error reading resource : BO / Acesso / FuncionariosProgramas . hbm . xml
at marcol . lib . HibernateUtil . < clinit > ( HibernateUtil . java : 43 )
... 21 more
Caused by : net . sf . hibernate . MappingException : Error reading resource : BO / Acesso / FuncionariosProgramas . hbm . xml
at net . sf . hibernate . cfg . Configuration . addResource ( Configuration . java : 318 )
at net . sf . hibernate . cfg . Configuration . doConfigure ( Configuration . java : 976 )
at net . sf . hibernate . cfg . Configuration . doConfigure ( Configuration . java : 928 )
at net . sf . hibernate . cfg . Configuration . configure ( Configuration . java : 856 )
at net . sf . hibernate . cfg . Configuration . configure ( Configuration . java : 842 )
at marcol . lib . HibernateUtil . < clinit > ( HibernateUtil . java : 39 )
... 21 more
Caused by : net . sf . hibernate . MappingException : duplicate import : FuncionariosProgramas
at net . sf . hibernate . cfg . Mappings . addImport ( Mappings . java : 85 )
at net . sf . hibernate . cfg . Binder . bindClass ( Binder . java : 126 )
at net . sf . hibernate . cfg . Binder . bindRootClass ( Binder . java : 221 )
at net . sf . hibernate . cfg . Binder . bindRoot ( Binder . java : 1229 )
at net . sf . hibernate . cfg . Configuration . add ( Configuration . java : 249 )
at net . sf . hibernate . cfg . Configuration . addInputStream ( Configuration . java : 285 )
at net . sf . hibernate . cfg . Configuration . addResource ( Configuration . java : 315 )
... 26 more
to iniciando agora com hibernate =]
o q ta pegando?
maxguzenski 1 de set. de 2006
Tambem pode ser… mas é mais provavel que seja erro do equals e hashcode (que ja foi dito que nao foi implementado)
diego.mendes 1 de set. de 2006
Peguei a referência do Hibernate e vi que meu bean nem tava Serializado, implementei conforme tava no Reference e agora tá rodando…
valeu moçada…vcs me ajudaram…
como faço pra avaliar.não sei a escala de valores?
5 é bom ou ruim?