Regular |
|
Joined: Tue Jun 22, 2004 8:01 pm Posts: 106 Location: PowderTown, Utah, USA
|
Here's an interesting challenge for you annotation gurus:
I'm using Hibernate 3 and Annotations. I've got an embedded component that is generic. In the containing class I then use AttributeOverride to change the column mapping. The only problem is Hibernate doesn't know what type the property is. The error I get is:
org.hibernate.AnnotationException: Property MyEmbedded.value 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
Here's an example (psuedocode, not compiled):
@Embeddable
public class MyEmbedded<T> {
private T value;
public T getValue() {return value;}
public void setValue(T value) {this.value = value}
}
@Entity
public class MyEntity {
private MyEmbedded embedded;
@Embedded
@AttributeOverride (name="value", column=@Column(name="textValue")
public MyEmbedded<String> getEmbedded() { return embedded; }
}
I can't find a way to tell Hibernate what the type is for the embedded "value" property. If the @AttributeOverride annotation allowed the type to be overridden, the above code would probably work. Is there a way to override the type?
|
|