Erro na consulta

Fala galera!!!

To executando essa consulta no BD:

[code] public List<Cliente> getAllClientes(int firstResult, int maxResults) {
EntityManagerFactory emf = Persistence.createEntityManagerFactory("persistenceUnit");
manager = emf.createEntityManager();
Query query = manager.createQuery("select nome from CLIENTES");

	if(maxResults&gt;0){
		query.setFirstResult(firstResult);
	}
	return query.getResultList();
}[/code]

E tá dando o seguinte erro:

[TopLink Info]: 2007.12.14 02:09:13.171--ServerSession(29194312)--TopLink, version: Oracle TopLink Essentials - 2.0 (Build b41-beta2 (03/30/2007)) [TopLink Info]: 2007.12.14 02:09:16.093--ServerSession(29194312)--file:/H:/Projetos/pocEJB3/bin/-persistenceUnit login successful [TopLink Warning]: 2007.12.14 02:09:16.828--ServerSession(29194312)--Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0 (Build b41-beta2 (03/30/2007))): oracle.toplink.essentials.exceptions.DatabaseException Internal Exception: java.sql.SQLException: Table/View 'CLIENTES' already exists in Schema 'CIANET'. Error Code: 30000 Call: CREATE TABLE CLIENTES (ID INTEGER NOT NULL, NOME VARCHAR(255), SOBRENOME VARCHAR(255), IDADE INTEGER, PRIMARY KEY (ID)) Query: DataModifyQuery() [TopLink Warning]: 2007.12.14 02:09:18.015--ServerSession(29194312)--Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0 (Build b41-beta2 (03/30/2007))): oracle.toplink.essentials.exceptions.DatabaseException Internal Exception: java.sql.SQLException: Table/View 'SEQUENCE' already exists in Schema 'CIANET'. Error Code: 30000 Call: CREATE TABLE SEQUENCE (SEQ_NAME VARCHAR(50) NOT NULL, SEQ_COUNT DECIMAL, PRIMARY KEY (SEQ_NAME)) Query: DataModifyQuery() 1 Exception in thread &quot;main&quot; java.lang.IllegalArgumentException: An exception occured while creating a query in EntityManager at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerImpl.createQuery(EntityManagerImpl.java:194) at ClienteDAOBean.getAllClientes(ClienteDAOBean.java:24) at ClienteDAOBean.getAllClientes(ClienteDAOBean.java:17) at Main.main(Main.java:17) Caused by: Exception [TOPLINK-8028] (Oracle TopLink Essentials - 2.0 (Build b41-beta2 (03/30/2007))): oracle.toplink.essentials.exceptions.EJBQLException Exception Description: Syntax error parsing the query [select nome from CLIENTES], line 1, column 26: unexpected end of query. Internal Exception: line 1:26: unexpected token: null at oracle.toplink.essentials.exceptions.EJBQLException.unexpectedEOF(EJBQLException.java:404) at oracle.toplink.essentials.internal.parsing.ejbql.EJBQLParser.handleANTLRException(EJBQLParser.java:330) at oracle.toplink.essentials.internal.parsing.ejbql.EJBQLParser.addError(EJBQLParser.java:262) at oracle.toplink.essentials.internal.parsing.ejbql.EJBQLParser.reportError(EJBQLParser.java:362) at oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.rangeVariableDeclaration(EJBQLParser.java:1742) at oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.identificationVariableDeclaration(EJBQLParser.java:1621) at oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.fromClause(EJBQLParser.java:454) at oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.selectStatement(EJBQLParser.java:179) at oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.document(EJBQLParser.java:135) at oracle.toplink.essentials.internal.parsing.ejbql.EJBQLParser.parse(EJBQLParser.java:150) at oracle.toplink.essentials.internal.parsing.ejbql.EJBQLParser.buildParseTree(EJBQLParser.java:111) at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:200) at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:174) at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:138) at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.&lt;init&gt;(EJBQueryImpl.java:99) at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.&lt;init&gt;(EJBQueryImpl.java:84) at oracle.toplink.essentials.internal.ejb.cmp3.EJBQueryImpl.&lt;init&gt;(EJBQueryImpl.java:71) at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerImpl.createQuery(EntityManagerImpl.java:189) ... 3 more Caused by: line 1:26: unexpected token: null at oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.rangeVariableDeclaration(EJBQLParser.java:1727) ... 16 more

Já tentei alterar essa query de todas as formas… mas não dei jeito…

Alguém tem alguma idéia do que seja?

Abraço!!!

da uma olhada se vc nao esta chamando outro metodo, pq aparentemente ele esta tentando criar a tabela

Tirei a configuração que tentava criar a tabela novamente do persistense.xml porém agora tá dando uma exception dizendo: Unknown abstract schema type

[TopLink Info]: 2007.12.17 11:23:26.078--ServerSession(5324016)--TopLink, version: Oracle TopLink Essentials - 2.0 (Build b41-beta2 (03/30/2007)) Exception in thread "main" Local Exception Stack: Exception [TOPLINK-8034] (Oracle TopLink Essentials - 2.0 (Build b41-beta2 (03/30/2007))): oracle.toplink.essentials.exceptions.EJBQLException Exception Description: Error compiling the query [Cliente.getAll: SELECT c FROM CLIENTES c]. Unknown abstract schema type [CLIENTES]. at oracle.toplink.essentials.exceptions.EJBQLException.unknownAbstractSchemaType(EJBQLException.java:479) at oracle.toplink.essentials.internal.parsing.ParseTreeContext.classForSchemaName(ParseTreeContext.java:148) at oracle.toplink.essentials.internal.parsing.SelectNode.getClassOfFirstVariable(SelectNode.java:351) at oracle.toplink.essentials.internal.parsing.SelectNode.getReferenceClass(SelectNode.java:339) at oracle.toplink.essentials.internal.parsing.ParseTree.getReferenceClass(ParseTree.java:452) at oracle.toplink.essentials.internal.parsing.ParseTree.adjustReferenceClassForQuery(ParseTree.java:88) at oracle.toplink.essentials.internal.parsing.EJBQLParseTree.populateReadQueryInternal(EJBQLParseTree.java:112) at oracle.toplink.essentials.internal.parsing.EJBQLParseTree.populateQuery(EJBQLParseTree.java:93) at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:204) at oracle.toplink.essentials.queryframework.EJBQLPlaceHolderQuery.processEjbQLQuery(EJBQLPlaceHolderQuery.java:96) at oracle.toplink.essentials.internal.sessions.AbstractSession.processEJBQLQueries(AbstractSession.java:2040) at oracle.toplink.essentials.internal.sessions.AbstractSession.processEJBQLQueries(AbstractSession.java:2027) at oracle.toplink.essentials.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:679) at oracle.toplink.essentials.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:559) at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:206) at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:212) at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:78) at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:111) at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:105) at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:76) at ClienteDAOBean.getAllClientes(ClienteDAOBean.java:22) at ClienteDAOBean.getAllClientes(ClienteDAOBean.java:17) at Main.main(Main.java:17)

Essa é a NamedQuery que estou testando:

@Entity @NamedQuery(name="Cliente.getAll", query="SELECT c FROM CLIENTES c") @Table(name="CLIENTES")

Aqui onde é chamada a named:

EntityManagerFactory emf = Persistence.createEntityManagerFactory("persistenceUnit"); manager = emf.createEntityManager(); Query query = manager.createNamedQuery("Cliente.getAll");

Já alterei a sintaxe dessa query de todo jeito, mas não tive sucesso… =S

Alguém pode ajudar com isso?..

Abraço