Hi All,
I'm trying to create an app that uses Hibrnate to connect to an Oracle 10g instance. I've followed a basic tutorial but keep getting the follwoing error:
org.hibernate.hql.ast.QuerySyntaxException: CONCEPT is not mapped. [select conceptcode from CONCEPT as c]
My config files and classes are listed below. Any pointers as to where I'm going wrong?
Thanks in advance
Angus
hibernate.cfg.xml
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="connection.url">
jdbc racle:thin:@82.47.247.82:1521
RCL</property>
<property name="connection.username">UKB_CMS_0_3</property>
<property name="connection.password">*y*ieKn1t3</property>
<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property>
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.OracleDialect</property>
<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">
thread</property>
<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<mapping resource="EntityPOJO.hbm.xml"/>
</session-factory>
</hibernate-configuration>
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.rose.ahr.hibernate.EntityPOJO" table="CONCEPT">
<id name="id" type="int" column="ID">
<generator class="native"/>
</id>
<property name="dtrCode" column="conceptcode"/>
</class>
</hibernate-mapping>
public void doCall(){
Session session = sessionFactory.openSession();
Transaction tx = session.beginTransaction();
Query query = session.createQuery("select conceptcode from ukb_cms_0_3.CONCEPT as c");
for (Iterator it = query.iterate(); it.hasNext()
{
EntityPOJO c = (EntityPOJO)it.next();
System.out.println("DTR = " + c.getDtrCode());
}
tx.commit();
session.close();
}