-->
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.  [ 2 posts ] 
Author Message
 Post subject: How to map a generic type?
PostPosted: Fri Jun 01, 2007 5:55 am 
Newbie

Joined: Fri Jun 01, 2007 5:36 am
Posts: 2
Hi,

I am developing an application which would be greatly simplified by the use of Java 5 generics in the data layer. I was wondering if there is a way to map this (through hibernate annotatios, if possible) to the underlying database.

I attach a piece of code to illustrate it:

public class Incident<Type extends Event> {
private Type event;

public Type getEvent() {
return event;
}

public void setEvent(Type event) {
this.event = event;
}
}

The class (and then the table) to which this entity (Incident) is associated can't be throughoutfully determined.

Thank you in advance


Top
 Profile  
 
 Post subject: Bug ANN-526
PostPosted: Mon Jun 04, 2007 2:07 pm 
Newbie

Joined: Fri Jun 01, 2007 5:36 am
Posts: 2
After trying to map it, I receive this Exception:
org.hibernate.AnnotationException: Property Incident.event has an unbound type and no explicit target entity. Resolve this Generic usage issue or set an explicit target attribute (eg @OneToMany(target=) or use an explicit @Type

But Type is not unbounded!. It seems to be a bug:
http://opensource.atlassian.com/project ... se/ANN-526

This bug remains open since 11/Jan/07, and it has minor priority. If you want it fixed, please vote for it in the JIRA web.

Thank you!


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