-->
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: How does Hibernate determine a generic collection type?
PostPosted: Sat May 05, 2012 11:06 am 
Newbie

Joined: Sat May 05, 2012 10:58 am
Posts: 2
Hi,

I always wondered how Hibernate or other JPA vendors determine the opposite entity of an association if it is mapped by a collection annotated just with @OneToMany or @ManyToMany like in the following snippet:

Code:
...
@OneToMany
public Set<Part> getParts() { return parts; }
void setParts(Set parts) { this.parts = parts; }
...


The information that parts is a Set<Part> can not be gathered using reflection as it is lost due to the type erasure. So how do you get this information??

I'd like to develop a generic BasicType to support Scala's generic Option[T] as regular column type. But therefore I need to know the type of T at runtime... But how?

Thanks in advance!
Christoph


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.