micmorba 18 de ago. de 2017
O itemValue do seu onemenuselect deve ser igual ao valor da var, pelo menos eu uso assim e da certo, ao comparar com os meus eu vi que isto está diferente. Tente por var=“candidato” e itemValue="#{candidato}"
FelipeJ 18 de ago. de 2017
Bom, isso não deu certo, ao fazer algumas correções na classe Votoconverter.java ele consegue prosseguir dentro de do metodo Votar(), porem ainda estou tendo dificuldades
FelipeJ 18 de ago. de 2017
Meu conversor VotoConverter
@FacesConverter (value = “votoConverter”)
public class VotoConverter implements Converter{
<a class= "mention" href= "/u/override" > @Override</a>
public Object getAsObject(FacesContext fc, UIComponent uic, String value) {
if(value !=null && !value.isEmpty()){
return uic.getAttributes().get(value);
}
return null;
}
<a class= "mention" href= "/u/override" > @Override</a>
public String getAsString(FacesContext fc, UIComponent uic, Object object) {
if(object !=null && object instanceof Candidato){
Candidato candidato = (Candidato) object;
uic.getAttributes().put(candidato.getCandidatoId().toString(), candidato);
return candidato.getCandidatoId().toString();
}
return “”;
}
}
O erro que eu estou tendo
GRAVE: Servlet.service() for servlet [Faces Servlet] in context with path [/AtividadeVI] threw exception [javax.persistence.RollbackException: Error while committing the transaction] with root cause
java.sql.SQLSyntaxErrorException: ORA-00904: “CANDIDATO”: identificador inválido
at oracle . jdbc . driver . T4CTTIoer . processError ( T4CTTIoer . java : 450 )
at oracle . jdbc . driver . T4CTTIoer . processError ( T4CTTIoer . java : 399 )
at oracle . jdbc . driver . T4C8Oall . processError ( T4C8Oall . java : 1059 )
at oracle . jdbc . driver . T4CTTIfun . receive ( T4CTTIfun . java : 522 )
at oracle . jdbc . driver . T4CTTIfun . doRPC ( T4CTTIfun . java : 257 )
at oracle . jdbc . driver . T4C8Oall . doOALL ( T4C8Oall . java : 587 )
at oracle . jdbc . driver . T4CPreparedStatement . doOall8 ( T4CPreparedStatement . java : 225 )
at oracle . jdbc . driver . T4CPreparedStatement . doOall8 ( T4CPreparedStatement . java : 53 )
at oracle . jdbc . driver . T4CPreparedStatement . executeForRows ( T4CPreparedStatement . java : 943 )
at oracle . jdbc . driver . OracleStatement . doExecuteWithTimeout ( OracleStatement . java : 1150 )
at oracle . jdbc . driver . OraclePreparedStatement . executeInternal ( OraclePreparedStatement . java : 4798 )
at oracle . jdbc . driver . OraclePreparedStatement . executeUpdate ( OraclePreparedStatement . java : 4875 )
at oracle . jdbc . driver . OraclePreparedStatementWrapper . executeUpdate ( OraclePreparedStatementWrapper . java : 1361 )
at org . hibernate . engine . jdbc . internal . ResultSetReturnImpl . executeUpdate ( ResultSetReturnImpl . java : 205 )
at org . hibernate . engine . jdbc . batch . internal . NonBatchingBatch . addToBatch ( NonBatchingBatch . java : 45 )
at org . hibernate . persister . entity . AbstractEntityPersister . insert ( AbstractEntityPersister . java : 3003 )
at org . hibernate . persister . entity . AbstractEntityPersister . insert ( AbstractEntityPersister . java : 3503 )
at org . hibernate . action . internal . EntityInsertAction . execute ( EntityInsertAction . java : 89 )
at org . hibernate . engine . spi . ActionQueue . executeActions ( ActionQueue . java : 589 )
at org . hibernate . engine . spi . ActionQueue . executeActions ( ActionQueue . java : 463 )
at org . hibernate . event . internal . AbstractFlushingEventListener . performExecutions ( AbstractFlushingEventListener . java : 337 )
at org . hibernate . event . internal . DefaultFlushEventListener . onFlush ( DefaultFlushEventListener . java : 39 )
at org . hibernate . internal . SessionImpl . doFlush ( SessionImpl . java : 1435 )
at org . hibernate . internal . SessionImpl . managedFlush ( SessionImpl . java : 491 )
at org . hibernate . internal . SessionImpl . flushBeforeTransactionCompletion ( SessionImpl . java : 3201 )
at org . hibernate . internal . SessionImpl . beforeTransactionCompletion ( SessionImpl . java : 2411 )
at org . hibernate . engine . jdbc . internal . JdbcCoordinatorImpl . beforeTransactionCompletion ( JdbcCoordinatorImpl . java : 467 )
at org . hibernate . resource . transaction . backend . jdbc . internal . JdbcResourceLocalTransactionCoordinatorImpl . beforeCompletionCallback ( JdbcResourceLocalTransactionCoordinatorImpl . java : 146 )
at org . hibernate . resource . transaction . backend . jdbc . internal . JdbcResourceLocalTransactionCoordinatorImpl . access $ 100 ( JdbcResourceLocalTransactionCoordinatorImpl . java : 38 )
at org . hibernate . resource . transaction . backend . jdbc . internal . JdbcResourceLocalTransactionCoordinatorImpl $ TransactionDriverControlImpl . commit ( JdbcResourceLocalTransactionCoordinatorImpl . java : 220 )
at org . hibernate . engine . transaction . internal . TransactionImpl . commit ( TransactionImpl . java : 68 )
at com . atividade . Dao . Dao . commit ( Dao . java : 54 )
at com . atividade . Beans . VotoBean . gravar ( VotoBean . java : 71 )
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 org . apache . el . parser . AstValue . invoke ( AstValue . java : 279 )
at org . apache . el . MethodExpressionImpl . invoke ( MethodExpressionImpl . java : 273 )
at org . jboss . weld . util . el . ForwardingMethodExpression . invoke ( ForwardingMethodExpression . java : 40 )
at org . jboss . weld . el . WeldMethodExpression . invoke ( WeldMethodExpression . java : 50 )
at com . sun . faces . facelets . el . TagMethodExpression . invoke ( TagMethodExpression . java : 105 )
at javax . faces . component . MethodBindingMethodExpressionAdapter . invoke ( MethodBindingMethodExpressionAdapter . java : 87 )
at com . sun . faces . application . ActionListenerImpl . processAction ( ActionListenerImpl . java : 102 )
at javax . faces . component . UICommand . broadcast ( UICommand . java : 315 )
at javax . faces . component . UIViewRoot . broadcastEvents ( UIViewRoot . java : 790 )
at javax . faces . component . UIViewRoot . processApplication ( UIViewRoot . java : 1282 )
at com . sun . faces . lifecycle . InvokeApplicationPhase . execute ( InvokeApplicationPhase . java : 81 )
at com . sun . faces . lifecycle . Phase . doPhase ( Phase . java : 101 )
at com . sun . faces . lifecycle . LifecycleImpl . execute ( LifecycleImpl . java : 198 )
at javax . faces . webapp . FacesServlet . service ( FacesServlet . java : 658 )
at org . apache . catalina . core . ApplicationFilterChain . internalDoFilter ( ApplicationFilterChain . java : 303 )
at org . apache . catalina . core . ApplicationFilterChain . doFilter ( ApplicationFilterChain . java : 208 )
at org . apache . tomcat . websocket . server . WsFilter . doFilter ( WsFilter . java : 52 )
at org . apache . catalina . core . ApplicationFilterChain . internalDoFilter ( ApplicationFilterChain . java : 241 )
at org . apache . catalina . core . ApplicationFilterChain . doFilter ( ApplicationFilterChain . java : 208 )
at org . apache . catalina . core . StandardWrapperValve . invoke ( StandardWrapperValve . java : 218 )
at org . apache . catalina . core . StandardContextValve . invoke ( StandardContextValve . java : 110 )
at org . apache . catalina . authenticator . AuthenticatorBase . invoke ( AuthenticatorBase . java : 506 )
at org . apache . catalina . core . StandardHostValve . invoke ( StandardHostValve . java : 169 )
at org . apache . catalina . valves . ErrorReportValve . invoke ( ErrorReportValve . java : 103 )
at org . apache . catalina . valves . AccessLogValve . invoke ( AccessLogValve . java : 962 )
at org . apache . catalina . core . StandardEngineValve . invoke ( StandardEngineValve . java : 116 )
at org . apache . catalina . connector . CoyoteAdapter . service ( CoyoteAdapter . java : 445 )
at org . apache . coyote . http11 . AbstractHttp11Processor . process ( AbstractHttp11Processor . java : 1115 )
at org . apache . coyote . AbstractProtocol $ AbstractConnectionHandler . process ( AbstractProtocol . java : 637 )
at org . apache . tomcat . util . net . JIoEndpoint $ SocketProcessor . run ( JIoEndpoint . java : 318 )
at java . util . concurrent . ThreadPoolExecutor . runWorker ( Unknown Source )
at java . util . concurrent . ThreadPoolExecutor $ Worker . run ( Unknown Source )
at org . apache . tomcat . util . threads . TaskThread $ WrappingRunnable . run ( TaskThread . java : 61 )
at java . lang . Thread . run ( Unknown Source )