-->
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.  [ 2 posts ] 
Author Message
 Post subject: Netbeans HQL problem
PostPosted: Sun Apr 12, 2009 5:29 pm 
Newbie

Joined: Sun Apr 12, 2009 5:19 pm
Posts: 1
Hello ,

In short terms my problem looks like this :

I have a java project made in netbeans . I've mapped my database with hibernate (POJO file)

the from 'table' works perfectly for all my tables but when i want to use select from statement i get org.hibernate.QueryException: Unable to resolve path


Examples used Clients table ( ClientID FirstName LastName)

select Clients.FirstName from Clients
select FirstName from Clients
select a.FirstName from Clients a
select firstName from Clients


java mapping xml

<hibernate-mapping>
<class catalog="airport" name="complete.entity.Clients" table="clients">
<id name="clientId" type="java.lang.Integer">
<column name="ClientID"/>
<generator class="identity"/>
</id>
<property name="firstName" type="string">
<column length="50" name="FirstName" not-null="true"/>
</property>
<property name="lastName" type="string">
<column length="50" name="LastName" not-null="true"/>
</property>
</class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 13, 2009 5:41 pm 
Senior
Senior

Joined: Tue Aug 01, 2006 9:24 pm
Posts: 120
Quote:
select Clients.FirstName from Clients
select FirstName from Clients
select a.FirstName from Clients a
select firstName from Clients


Your syntax is wrong make sure that your column is the name of the property on the pojo and that you use the alias in the from clause not full class name.

If you have a class like this

Code:
public class Clients{
   String firstName;
}


then you would want your select to look like this
Code:
SELECT a.firstName FROM Clients a
[/quote]

_________________
Please rate my replies as I need points for all of my questions also.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.