Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

tricky hql where clause

Posted on 2007-04-05
3
376 Views
Last Modified: 2008-02-01
Hi,

I am trying perform select hql, but where clause is a bit tricky. I have two classes like this:
+++++++

public class Project extends ActionForm implements java.io.Serializable {

private Long projectId;
private Demographics demographics;
...
...

+++++++++++++

public class Demographics extends ActionForm implements java.io.Serializable {

    private Long demographicsId;//pk
    private Set projects = new HashSet(0);
...
...

+++++++++++

and it is 1 - N relastionship. I tried this in HQL editor, but didn't return anything.

FROM Project as project where project.demographics.demographicsId='1234'

What hql is going to look like in this case?

thx
0
Comment
Question by:dkim18
3 Comments
 
LVL 13

Accepted Solution

by:
bglodde earned 250 total points
ID: 18970947
FROM Project as project where project.demographics.demographicsId='1234'

"demographicsId" is undoubtedly a numeric datatype of some sort, so you won't need single quotes
FROM Project as project where project.demographics.demographicsId=1234

If that doesn't set it straight, check your capitalizations and turn on the option:
<prop key="hibernate.show_sql">true</prop>
so you can see what Hibernate is generating for the actual query.

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question