[jboss-user] [JBoss Seam] - Class type issue

lcoetzee do-not-reply at jboss.com
Wed Jul 4 08:13:42 EDT 2007


Hi,

I have quite an interesting issue (which at this point has me stumped).

I have a class Service that has a one-to-many to Topic (which is a base clase). Topic is extended into three other (CMSTopic, DFTopic and MMTopic). 
Service

  | @Entity
  | @Name("service")
  | @Table(name = "service")
  | public class Service implements Serializable {
  | private Map<Integer,Topic> topics = new HashMap<Integer,Topic>();	
  | 
  | @OneToMany(mappedBy = "service")
  | 	@MapKey(name="id")
  | 	public Map<Integer,Topic> getTopics() {
  | 		return topics;
  | 	}
  | }

Topic


@Entity
  | @Name("topic")
  | @Table(name = "topic")
  | @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
  | @DiscriminatorColumn(name = "topic_type", discriminatorType = DiscriminatorType.STRING)
  | 
  | public class Topic implements Serializable {
  | private Service service;
  | @ManyToOne(fetch=FetchType.LAZY)
  | 	public Service getService() {
  | 		return service;
  | 	}
  | }
  | 
  | 
and the extended classes e.g. CMSTopic

  | @Entity
  | @Name("cmsTopic")
  | @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
  | @DiscriminatorColumn(discriminatorType = DiscriminatorType.STRING)
  | @DiscriminatorValue("CMS")
  | public class CMSTopic extends Topic {
  | }

When I do a service.getTopics().values() the correct subclasses of Topic is returned. But for some reason the instance type is weird.. I get the following when doing an getClass() on each element in the returned map:
class csir.structure.par.DFTopic 
class csir.structure.par.CMSTopic 
class csir.structure.par.Topic_$$_javassist_227
class csir.structure.par.CMSTopic

Does anybody have an idea of why only one of these would be Topic_$$_javassist_227 while the others are the correct type ?

Thanks 

Louis



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4060403#4060403

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4060403



More information about the jboss-user mailing list