-->
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.  [ 1 post ] 
Author Message
 Post subject: Is it a simple question?
PostPosted: Sat Jun 20, 2009 2:29 pm 
Newbie

Joined: Sat Jun 20, 2009 2:04 pm
Posts: 3
I have 3 classes: A, B, C

class A {
private HashMap<String, B> Bs;
@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.PERSIST, mappedBy = "a")
public HashMap<String, B> getBs() {
return Bs;
}
}

class B {
Long id;
A a;
C c;
@OneToOne
@JoinColumn(name="cId", nullable=false)
public C getC() {
return c;
}
}

class C {
@Id
String name;
......
}

I want to fetch A and at the same time eager fetch B. I also want to use c.name as the hashmap key.(c.name is in the table B as cId) But I don't want to eager fetch C, because C has many other attributes which i don't need. Is it possible? If yes, how can do it? (I didn't use mapkey because it will use class C as the key which is not what i want. maybe there is another way using mapkey that can achieve my goal)

Thanks in advance


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.