Olá pessoal,
Recomeçando algumas coisas aqui, decidi usar o EclipseLink, fiz uns testes
de inserção e busca, e tudo funciona bem com o Postgre, resolvi mudar a conexão
para MySql e minha instrução select já n funciona mais, n deveria funcionar com qq banco?
Com Postgre tenho o resultado esperado, com MySql tenho isto:
run:
[EL Info]: 2010-03-20 08:50:34.326–ServerSession(2026549)–EclipseLink, version: Eclipse Persistence Services - 2.0.0.v20091127-r5931
[EL Info]: 2010-03-20 08:50:34.758–ServerSession(2026549)–file:/media/arquivos/projetos/jutil/src/_jutilPU2 login successful
[EL Warning]: 2010-03-20 08:50:34.986–UnitOfWork(27890503)–Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.0.0.v20091127-r5931): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘.conta_tipo WHERE (tipo_descricao LIKE ‘x%’)’ at line 1
Error Code: 1064
Call: SELECT tipo_id, tipo_descricao FROM phenix.public.conta_tipo WHERE (tipo_descricao LIKE ?)
bind => [x%]
Query: ReadAllQuery(referenceClass=ContaTipo sql=“SELECT tipo_id, tipo_descricao FROM phenix.public.conta_tipo WHERE (tipo_descricao LIKE ?)”)
Exception in thread “main” javax.persistence.RollbackException: Transaction rolled back because transaction was set to RollbackOnly.
at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commitInternal(EntityTransactionImpl.java:92)
at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commit(EntityTransactionImpl.java:63)
at br.com.Jutil.JPABasicDAO.getLista(JPABasicDAO.java:115)
at br.com.util.dao.ContaTipoDAO.listaContaTipo(ContaTipoDAO.java:20)
at br.com.Jutil.NewClass.main(NewClass.java:23)
Java Result: 1
Grato,