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.  [ 5 posts ] 
Author Message
 Post subject: query construction
PostPosted: Tue Feb 14, 2006 2:07 pm 
Newbie

Joined: Tue Feb 14, 2006 1:56 pm
Posts: 2
hello all.
I was hoping that someone could bounce ideas with me.
I need to create query. Ultimately, I need a "parent list".
I have a tree-like structure with id and parent id. I have a result set list already with id and parent id (if there is one).

For example: from subtree 1 result set to contain 1,3
Code:
1
|_2
|_3
     |_4
|_5


For example: from subtree 1 result set to contain 6, 8
Code:
6
  |_7
  |_8
      |_9


After finding the top level I will execute a query based on the subtree and build a result set to be returned after the for looping.

Any ideas appreciated.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 14, 2006 4:56 pm 
Regular
Regular

Joined: Sat Nov 19, 2005 2:46 pm
Posts: 69
You're talking about result sets as though you're dealing with JDBC statements. There's no way to understand from your description what you really want.
I suggest you study Chapter 7 "Collection Mapping" from the Hibernate reference, and then search out references to the term "parent-child". It's a fairly standard Hibernate pattern, and has nothing to do with result sets.
Hope that helps.

_________________
Stewart
London, UK


Top
 Profile  
 
 Post subject: at dao level using HQL
PostPosted: Tue Feb 14, 2006 5:20 pm 
Newbie

Joined: Tue Feb 14, 2006 1:56 pm
Posts: 2
I am at the DAO level and I am writing my own HQL queries. My hibernate mapping is already working correctly. I don't want to return the entire class. I am trying to work with selected fields only and I don't want to work with data-transfer classes for each query.


Top
 Profile  
 
 Post subject: Re: at dao level using HQL
PostPosted: Wed Feb 15, 2006 7:05 am 
Regular
Regular

Joined: Sat Nov 19, 2005 2:46 pm
Posts: 69
kerkor wrote:
I don't want to return the entire class.


Erm, a class (or object of that class) is an atomic unit. Definition of "atomic":
http://www.techweb.com/encyclopedia/defineterm.jhtml?term=atomic wrote:
Indivisible.


kerkor wrote:
I have a tree-like structure with id and parent id. I have a result set list already with id and parent id (if there is one). ... After finding the top level I will execute a query based on the subtree and build a result set to be returned after the for looping.


What you are saying still makes no sense to me. It does not seem sequiteur to me.
If you want help you need to communicate the concept in your mind so that arrives in the other guy's mind without confusion.

I think that you are thinking in terms of "data" not in terms of "objects". My only suggestion can be to re-visit the design of your object model, because it seems it is not doing naturally and easily what you need from it. If I am being patronizing then I apologise, and have no more to say.

http://en.wikipedia.org/wiki/Object-oriented_programming wrote:
The idea behind object-oriented programming is that a computer program may be seen as composed of a collection of individual units, or objects, that act on each other, as opposed to a traditional view in which a program may be seen as a collection of functions or procedures, or simply as a list of instructions to the computer.

_________________
Stewart
London, UK


Top
 Profile  
 
 Post subject: Re: at dao level using HQL
PostPosted: Wed Feb 15, 2006 7:30 am 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
kerkor wrote:
I am at the DAO level and I am writing my own HQL queries. My hibernate mapping is already working correctly. I don't want to return the entire class. I am trying to work with selected fields only and I don't want to work with data-transfer classes for each query.



I'm having trouble following as well.
Maybe if you showed your Class, mappings, sample code - or a scaled-down example of them.

_________________
Preston

Please don't forget to give credit if/when you get helpful information.


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