Erro ao retornar Dados

[quote=MaktubBruno]Galera, Bom Dia!

Bom, estou com um erro um tanto curioso e não consigo encontra-lo.
Estou tentando retornar os registros de minha tabela no Firebird e está dando o seguinte erro: org.hibernate.hql.ast.QuerySyntaxException : CURSOS is not mapped [FROM CURSOS]

Porém minha classe está mapeada, vejam:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC 
    "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
    "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">

<hibernate-configuration> 
	<session-factory>
        <property name="hibernate.connection.driver_class">org.firebirdsql.jdbc.FBDriver</property>  
        <property name="hibernate.connection.url">jdbc:firebirdsql:localhost/3050:E:/Desenvolvimento/EHWeb/Eclipse 3.6/workspace/EHWeb01/Bdeh3/ANUAL_EH03_11.FDB</property>
        <property name="hibernate.connection.username">SYSDBA</property>
        <property name="hibernate.connection.password">masterkey</property>         
        <property name="hibernate.dialect">org.hibernate.dialect.FirebirdDialect</property>
        <property name="show_sql">true</property>        		
		<mapping resource="br/com/ehweb/business/repositorys/hbm/Cursos.hbm.xml" />						   
	</session-factory>  
</hibernate-configuration>

Segue hbm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC 
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
    
<hibernate-mapping>
	<class name="br.com.ehweb.business.entitys.Cursos" table="CURSOS">
		<id name="curCodigo" column="CUR_CODIGO">
			<generator class="sequence">
				<param name="sequence">GEN_CURSOS_ID</param>			
			</generator>
		</id>
		<property name="curDescricao" column="CUR_DESCRICAO" />
	</class>	
</hibernate-mapping>

O método getList()

        public List<Cursos> getList() throws Exception {
		List<Cursos> lista = sessao.createQuery("FROM CURSOS").list();      		
		sessao.close();
		return lista;
	}

No console aparece o seguinte:

203 ["http-bio-8080"-exec-17] INFO org.hibernate.annotations.common.Version - Hibernate Commons Annotations 3.2.0.Final
203 ["http-bio-8080"-exec-17] INFO org.hibernate.cfg.Environment - Hibernate 3.6.0.Final
218 ["http-bio-8080"-exec-17] INFO org.hibernate.cfg.Environment - hibernate.properties not found
218 ["http-bio-8080"-exec-17] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist
218 ["http-bio-8080"-exec-17] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
343 ["http-bio-8080"-exec-17] INFO org.hibernate.cfg.Configuration - configuring from resource: hibernate.cfg.xml
343 ["http-bio-8080"-exec-17] INFO org.hibernate.cfg.Configuration - Configuration resource: hibernate.cfg.xml
421 ["http-bio-8080"-exec-17] INFO org.hibernate.cfg.Configuration - Reading mappings from resource : br\com\ehweb\business\repositorys\hbm\Cursos.hbm.xml
453 ["http-bio-8080"-exec-17] INFO org.hibernate.cfg.Configuration - Configured SessionFactory: null
546 ["http-bio-8080"-exec-17] INFO org.hibernate.cfg.HbmBinder - Mapping class: br.com.ehweb.business.entitys.Cursos -> CURSOS
578 ["http-bio-8080"-exec-17] INFO org.hibernate.cfg.Configuration - Hibernate Validator not found: ignoring
593 ["http-bio-8080"-exec-17] INFO org.hibernate.cfg.search.HibernateSearchEventListenerRegister - Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.
609 ["http-bio-8080"-exec-17] INFO org.hibernate.connection.DriverManagerConnectionProvider - Using Hibernate built-in connection pool (not for production use!)
609 ["http-bio-8080"-exec-17] INFO org.hibernate.connection.DriverManagerConnectionProvider - Hibernate connection pool size: 20
609 ["http-bio-8080"-exec-17] INFO org.hibernate.connection.DriverManagerConnectionProvider - autocommit mode: false
609 ["http-bio-8080"-exec-17] INFO org.hibernate.connection.DriverManagerConnectionProvider - using driver: org.firebirdsql.jdbc.FBDriver at URL: jdbc:firebirdsql:localhost/3050:E:/Desenvolvimento/EHWeb/Eclipse 3.6/workspace/EHWeb01/Bdeh3/ANUAL_EH03_11.FDB
609 ["http-bio-8080"-exec-17] INFO org.hibernate.connection.Dr)/P10
    version : WI-V2.0.3.12981 Firebird 2.03WI-V2.0.3.12981 Firebird 2.0/tcp (bruno)/P10
      major : 2
      minor : 0
625 ["http-bio-8080"-exec-17] INFO org.hibernate.cfg.SettingsFactory - Driver ->
       name : Jaybird JCA/JDBC driver
    version : 2.1
      major : 2
      minor : 1
656 ["http-bio-8080"-exec-17] INFO org.hibernate.dialect.Dialect - Using dialect: org.hibernate.dialect.FirebirdDialect
687 ["http-bio-8080"-exec-17] INFO org.hibernate.engine.jdbc.JdbcSupportLoader - Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4
687 ["http-bio-8080"-exec-17] INFO org.hibernate.transaction.TransactionFactoryFactory - Using default transaction strategy (direct JDBC transactions)
687 ["http-bio-8080"-exec-17] INFO org.hibernate.transaction.TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
687 ["http-bio-8080"-exec-17] INFO org.hibernate.cfg.SettingsFactory - Automatic flush during beforeCompletion(): disabled
687 ["http-bio-8080"-exec-17] INFO org.hibernate.cfg.SettingsFactory - Automatic session close at end of transaction: disabled
687 ["http-bio-8080"-exec-17] INFO org.hibernate.cfg.SettingsFactory - Scrollable result sets: enabled
687 ["http-bio-8080"-exec-17] INFO org.hibernate.cfg.SettingsFactory - JDBC3 getGeneratedKeys(): disabled
687 ["http-bio-8080"-exec-17] INFO org.hibernate.cfg.SettingsFactory - Connection release mode: auto
687 ["http-bio-8080"-exec-17] INFO org.hibernate.cfg.SettingsFactory - Default batch fetch size: 1
687 ["http-bio-8080"-exec-17] INFO org.hibernate.cfg.SettingsFactory - Generate SQL with comments: disabled
687 ["http-bio-8080"-exec-17] INFO org.hibernate.cfg.SettingsFactory - Order SQL updates by primary key: disabled
687 ["http-bio-8080"-exec-17] INFO org.hibernate.cfg.SettingsFactory - Order SQL inserts for batching: disabled
687 ["http-bio-8080"-exec-17] INFO org.hibernate.cfg.SettingsFactory - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
687 ["http-bio-8080"-exec-17] INFO org.hibernate.hql.ast.ASTQueryTranslatorFactory - Using ASTQueryTranslatorFactory
687 ["http-bio-8080"-exec-17] INFO org.hibernate.cfg.SettingsFactory - Query language substitutions: {}
687 ["http-bio-8080"-exec-17] INFO org.hibernate.cfg.SettingsFactory - JPA-QL strict compliance: disabled
687 ["http-bio-8080"-exec-17] INFO org.hibernate.cfg.SettingsFactory - Second-level cache: enabled
687 ["http-bio-8080"-exec-17] INFO org.hibernate.cfg.SettingsFactory - Query cache: disabled
687 ["http-bio-8080"-exec-17] INFO org.hibernate.cfg.SettingsFactory - Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory
687 ["http-bio-8080"-exec-17] INFO org.hibernate.cfg.SettingsFactory - Optimize cache for minimal puts: disabled
687 ["http-bio-8080"-exec-17] INFO org.hibernate.cfg.SettingsFactory - Structured second-level cache entries: disabled
703 ["http-bio-8080"-exec-17] INFO org.hibernate.cfg.SettingsFactory - Echoing all SQL to stdout
703 ["http-bio-8080"-exec-17] INFO org.hibernate.cfg.SettingsFactory - Statistics: disabled
703 ["http-bio-8080"-exec-17] INFO org.hibernate.cfg.SettingsFactory - Deleted entity synthetic identifier rollback: disabled
703 ["http-bio-8080"-exec-17] INFO org.hibernate.cfg.SettingsFactory - Default entity-mode: pojo
703 ["http-bio-8080"-exec-17] INFO org.hibernate.cfg.SettingsFactory - Named query checking : enabled
703 ["http-bio-8080"-exec-17] INFO org.hibernate.cfg.SettingsFactory - Check Nullability in Core (should be disabled when Bean Validation is on): enabled
734 ["http-bio-8080"-exec-17] INFO org.hibernate.impl.SessionFactoryImpl - building session factory
1187 ["http-bio-8080"-exec-17] INFO org.hibernate.impl.SessionFactoryObjectFactory - Not binding factory to JNDI, no JNDI name configured

[/quote]

Bom vim apenas para dizer que resolvi…
O problema era que eu estava colocando o nome da Tabela e não da Classe

Alterei de:

	public List<Cursos> getList() throws Exception {
		List<Cursos> lista = sessao.createQuery("FROM CURSOS").list();      		
		sessao.close();
		return lista;
	}

para:

	public List<Cursos> getList() throws Exception {
		List<Cursos> lista = sessao.createQuery("FROM Cursos").list();      		
		sessao.close();
		return lista;
	}

O problema agora é outro, porém, vou ver se resolvo aki…