This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate Oracle problem

 
Angus Rose
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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();

}
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shouldn't your query string be:

select conceptcode from EntityPOJO as c
 
Angus Rose
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why yes, it should be. If I had a daughter I would offer you her hand in marriage. However, I don't. So instead please accept my deepest gratitude for saving my skin.

Thank you

Angus
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm... I was once married, in an online fantasy game. My Internet wife and I contemplated having children, but that would have severely drained my power crystals.
 
Angus Rose
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I must say there are times when I think marriage should be limited to online fantasy games, but then why spoil them? Saw a forum entry on runescape once suggesting the idea (and families too) Laughed myself into a hernia - online nagging!!!What???
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic