-->
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.  [ 3 posts ] 
Author Message
 Post subject: HQL query for one class returning multiple classes
PostPosted: Mon Aug 28, 2006 11:42 am 
Newbie

Joined: Fri Aug 11, 2006 3:59 pm
Posts: 2
I think this is a newbie question, so if there's a link to documentation that explains what I screwed up and what I'm supposed to do, thanks in advance.

Environment (in part): JDK 1.5.0 Update 6, Hibernate 3.1.3, mySQL 5.0.22, Eclipse 3.2, MyEclipse 5.0

Here's a distilled version of my situation (hopefully): I have two objects, Submission and SubmissionStep. I'm querying for all Submission objects via this HQL:

"from Submission"

Unexpectedly, I'm getting back all Submission objects AND all SubmissionStep objects.

Has anybody seen this behavior before?

Also, if I need to provide more context, please let me know. The DDL that Hibernate generates for the tables is as follows:

Code:
    drop table if exists seccheck.Submission

    drop table if exists seccheck.SubmissionSteps

    create table seccheck.Submission (
        SubmissionID integer not null auto_increment,
        UserMachineID integer not null,
        MachineStateID integer not null,
        SubmitDateTime integer not null,
        SubmitIP integer not null,
        GUID tinyblob not null,
        primary key (SubmissionID)
    ) type=MyISAM

    create table seccheck.SubmissionSteps (
        StepID integer not null auto_increment,
        ComponentID integer not null,
        OrderID integer not null,
        ShortName varchar(20) not null,
        LongName varchar(128) not null,
        primary key (StepID)
    ) type=MyISAM


Thanks,

Philip Sloss


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 28, 2006 1:58 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
the feature is called implicit polymorphism; the same that allows you to to "from java.lang.Object"

see docs how it works and how to disable it per class.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 28, 2006 2:34 pm 
Newbie

Joined: Fri Aug 11, 2006 3:59 pm
Posts: 2
max wrote:
the feature is called implicit polymorphism; the same that allows you to to "from java.lang.Object"

see docs how it works and how to disable it per class.

Thank you -- and of course after hours of head scratching, minutes after I posted this, I found a big clue about what we were screwing up. (I don't think the head scratching helped or hurt.)

Thanks again for the pointer -- er, um, reference

Philip Sloss


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