NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

[Solved] HQL Query: QuerySyntaxException: Client is not mapped

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users
View previous topic :: View next topic  
Author Message
revo1789



Joined: 24 Jul 2010
Posts: 2
Location: Rabat, Morocco

PostPosted: Sat Jul 24, 2010 3:39 am    Post subject: [Solved] HQL Query: QuerySyntaxException: Client is not mapped Reply with quote

Hi everybody,

I had just begun my first web application with NetBeans and using the frameworks JSF et Hibernate. I followed step by step the official tutorial in Netbeans's Website Using Hibernate in a Web Application, but I had some trouble when I tried to test my queries with HQL Query. In summary, I :

1. created the Hibernate Reverse Engineering file

2. created the Hibernate POJOs and Mapping XML files

3. created a Java class named ClientHelper that would help me retrieving and displaying data

When I tape 'from Client' in the HQL Query, I had this kind of message: QuerySyntaxException: Client is not mapped. Can someone help me??

The Client.hbm.xml file
Code:

<hibernate-mapping>
    <class name="Mapping.Client" table="client" catalog="callcenter">
        <id name="idClient" type="int">
            <column name="ID_CLIENT" />
            <generator class="assigned" />
        </id>
        <property name="numPack" type="int">
            <column name="NUM_PACK" not-null="true" />
        </property>
        <property name="nomClient" type="string">
            <column name="NOM_CLIENT" length="65535" />
        </property>
        <property name="ca" type="java.lang.Double">
            <column name="CA" precision="22" scale="0" />
        </property>
        <property name="adresseClient" type="string">
            <column name="ADRESSE_CLIENT" length="65535" />
        </property>
        <property name="telClient" type="java.lang.Long">
            <column name="TEL_CLIENT" />
        </property>
        <property name="faxClient" type="java.lang.Long">
            <column name="FAX_CLIENT" />
        </property>
        <property name="nbrEmployes" type="java.lang.Long">
            <column name="NBR_EMPLOYES" />
        </property>
        <property name="etatClient" type="string">
            <column name="ETAT_CLIENT" length="65535" />
        </property>
        <property name="emailClient" type="string">
            <column name="EMAIL_CLIENT" length="65535" />
        </property>
        <property name="sitewebClient" type="string">
            <column name="SITEWEB_CLIENT" length="65535" />
        </property>
        <set name="factures" inverse="true">
            <key>
                <column name="ID_CLIENT" not-null="true" />
            </key>
            <one-to-many class="Mapping.Facture" />
        </set>
    </class>
</hibernate-mapping>


The hibernate.cfg.xml file:

Code:

<hibernate-configuration>
  <session-factory>
    <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
    <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/callcenter</property>
    <property name="hibernate.connection.username">root</property>
    <property name="hibernate.connection.password">root</property>
    <property name="hibernate.show_sql">true</property>
    <property name="hibernate.current_session_context_class">thread</property>
    <mapping resource="Mapping/Facture.hbm.xml"/>
    <mapping resource="Mapping/Client.hbm.xml"/>
  </session-factory>
</hibernate-configuration>


Thanks a lot.


Last edited by revo1789 on Sat Jul 24, 2010 3:53 am; edited 1 time in total
Back to top
revo1789



Joined: 24 Jul 2010
Posts: 2
Location: Rabat, Morocco

PostPosted: Sat Jul 24, 2010 3:52 am    Post subject: Reply with quote

This is weird, but I found a similar case in a french forum..

The solution is to build the project before trying to test the HQL Query window, just that Smile
Back to top
bublifux



Joined: 13 Aug 2010
Posts: 2

PostPosted: Fri Aug 13, 2010 9:20 pm    Post subject: Reply with quote

I had the same problem. The solution was to use a full path to the class, e.g. "from org.something.Class"
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users All times are GMT
Page 1 of 1

 
Jump to:  
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
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo