-->
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: @Target doesn't work? Or am I using it wrong?
PostPosted: Tue Aug 04, 2009 10:14 am 
Newbie

Joined: Mon Aug 03, 2009 9:18 am
Posts: 5
I'm having some awful JAXB/Hibernate crossover problems with Sets. In order to send my objects with JAXB, I have had to make my Sets non-generic, as it can't find the generics information. However, I can't seem to get Hibernate to accept that my subclass of Set is a Set. At once, I got "Illegal attempt to map a non collection as a @OneToMany ..." exception, which I soon found was because Hibernate only accepts a few classes for @OneToMany. I thought (from the fairly sparse docs) that I could use the @Target annotation to tell Hibernate that it should consider the field a Set regardless of what reflection says, but I'm still getting the same exception.

My class (in excerpt) looks like this:

Code:
@Entity
@Table(name = "OC_ConfigurationSet")
public class ConfigurationSet {
  @Id
  @Column(name = "Id")
  long id;

  @OneToMany(cascade={CascadeType.PERSIST, CascadeType.REMOVE}, targetEntity = DeliveryConfig.class)
  @JoinTable(name="OC_ConfigSetXDeliveryConfig",
  joinColumns= @JoinColumn(name = "ConfigurationSetID"),
  inverseJoinColumns= @JoinColumn(name = "DeliveryConfigID"))
  @Target(Set.class)
  DeliveryConfigSet deliveries;
}


The DeliveryConfigSet class is this simple:

Code:
public class DeliveryConfigSet extends HashSet<DeliveryConfig> {
}


Should @Target in conjunction with the targetEntity argument on @OneToMany not be able to do this for me? Is there some other way I can convince Hibernate to map this?

I'm using the Hibernate that comes with JBoss 5.1.0 GA (I believe that is 3.3.1.GA) on an Ubuntu 8.10 x86 box against an Oracle 10 database.

Thanks in advance,
-Lars


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.