-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: weird error with hibernate plugin, runs but displays error
PostPosted: Thu Jul 03, 2008 2:59 am 
Newbie

Joined: Thu Jul 03, 2008 1:57 am
Posts: 2
Hi,

I am using the following tools -
Hibernate Plugin for eclipse - 3.2.3
Eclipse version - 3.3.2
Hibernate Version - 3

Mapping Documents -

hibernate.cfg.xml -->

<hibernate-configuration>
<session-factory>
<property name="hibernate.bytecode.use_reflection_optimizer">false</property>
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.password">xxx</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@xxx:1521:xxxx</property>
<property name="hibernate.connection.username">xxx</property>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
<property name="current_session_context_class">thread</property>
<property name="show_sql">true</property>
<mapping resource="src/TPathInfo.hbm.xml" />
</session-factory>
</hibernate-configuration>

TPathInfo.hbm.xml -->

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated 3/07/2008 11:57:22 by Hibernate Tools 3.2.2.GA -->
<hibernate-mapping>
<class name="src.TPathInfo" table="T_PATHINFO" schema="PROVISION">
<id name="pathInfo" type="string">
<column name="PATHINFO" length="4000" />
<generator class="assigned" />
</id>
</class>
</hibernate-mapping>

TPathInfo -->

Code:
package src;

public class TPathInfo {

   private String pathInfo;
   
   public TPathInfo() {
      
   }
   public TPathInfo(String pathInfo) {
      this.pathInfo = pathInfo;
   }
   
   public String getPathInfo() {
      return this.pathInfo;
   }

   public void setPathInfo(String pathInfo) {
      this.pathInfo = pathInfo;
   }
      
}


TestClient.java -->

Code:
List <TPathInfo> result = session.createQuery("from src.TPathInfo").list();
System.out.println("result----->"+result.get(0).getPathInfo());
session.getTransaction().commit();
session.close();


Result of running TestClient

Hibernate: select tpathinfo0_.PATHINFO as PATHINFO1_ from PROVISION.T_PATHINFO tpathinfo0_
result---SPVP;XDM/SDNMFloe/Path/200409271714511372;/FNN=61444555111/vpi=5;/FNN=61444555112/vpi=5;


Error -->

org.hibernate.hql.ast.QuerySyntaxException: src.TPathInfo is not mapped [from src.TPathInfo]


Query --

When I run TestClient it runs fine and gives the desired result. Its not an issue with the code not working.

But in Eclipse createQuery("from src.TPathInfo") is always marked and underlined in red and on moving the mouse pointer to it the following error is shown-
src.TPathInfo is not mapped [from src.TPathInfo]

Also when I use the plugin's HQL Editor and execute from src.TPathInfo the same exception is produced with no output ie it fails.

1) I am wondering why is the code working fine but still showing an error in Eclipse?
2) Why is the query not working in HQL Editor?
3) How do I get the query working in HQL Editor and also remove the error from TestClient.java?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 03, 2008 9:06 pm 
Newbie

Joined: Thu Jul 03, 2008 1:57 am
Posts: 2
The problem was solved by cleaning the project and doing a rebuild....grrrrrh


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 12, 2008 7:44 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
the hbm.xml file were probably not yet copied to the classpath ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.