Solved

tricky hql where clause

Posted on 2007-04-05
3
358 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

746 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now