-->
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: Mapping issue in fatching specific fields from two tables
PostPosted: Wed Jul 16, 2008 7:04 am 
Newbie

Joined: Sat Jul 12, 2008 4:17 am
Posts: 9
Case:

Class A {
int id;
string name;
string address
List<B> blist;

}

Calss B {
int id;
string Bname;
A aobj;
}

Get and Set method and requried constructor are impletemented

HQL Syntax:

Select new A(id,name) from A as a where a.id=2;

Above case is correct and running fine and retuning A objects

But what I require is that object of A also contans B's object which populated with few specific properties such as only "Bname" in B objects. Is it possible? If yes so what is the solution.

Thanks


Top
 Profile  
 
 Post subject: Re: Mapping issue in fatching specific fields from two table
PostPosted: Wed Jul 16, 2008 11:31 am 
Expert
Expert

Joined: Wed Apr 11, 2007 11:39 am
Posts: 735
Location: Montreal, QC
Is there any specific reason you use a constructor for As? You could do the following:

Code:
select a from A as a join fetch a.blist where a.id = 2



Farzad-


Top
 Profile  
 
 Post subject: Re: Mapping issue in fatching specific fields from two table
PostPosted: Thu Jul 17, 2008 3:06 pm 
Newbie

Joined: Sat Jul 12, 2008 4:17 am
Posts: 9
Farzad-
I only want to fetch specific fields in beans not complete pojo is needed which i mention in question

[quote="farzad"]Is there any specific reason you use a constructor for As? You could do the following:

[code]select a from A as a join fetch a.blist where a.id = 2[/code]


Farzad-[/quote]


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.