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?