-->
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: Map of "discriminator"-ed objects, with formula key
PostPosted: Fri May 28, 2010 5:26 pm 
Newbie

Joined: Thu May 14, 2009 1:59 pm
Posts: 4
Oh yeah, and since it wouldn't fit in the subject, I'm also using a mixture of hbm.xml's and annotations. Apparently, I'm a glutton for punishment.

I don't have the exact code at the moment, so I'm going to try to explain approximately what I'm trying to do.

Following 5 classes (pseudoish-code)
Code:
public class Obj {
    @Id
    Integer id;

   // key is a formula, which ends up being the name
   // of the module this moudelinst is an instance of.
   // this mapping is done in hbm.xml
    Map<String,Moduleinst> moduleinstMap;

}

public class Module{
     @Id
     Integer id;

    @Column(...)
    String name;
}

@DiscriminatorFormula( /* name from corresponding module */ )
public class ModuleInst {
     @Id
     Integer id;

     @Column(...)
     Obj obj;

     @Column(...)
     Module module;
}

@DiscriminatorValue("ModuleA")
public class ModuleA extends ModuleInst{
    Object moduleASpecialItem;
}

@DiscriminatorValue("ModuleinstB")
public class ModuleInstB extends ModuleInst{
    Object moduleBSpecialItem;
}



Most of the time, the map on Obj works wonderfully and the entities in the map are of the discriminated classes. On occasion though, *some* of them are instead an object of type (something like:) Moduleinst_123_somethingsomething, or something like that. IIRC, this is a class generated by Hibernate (by means of other library). why is this happening? Also, just to throw some extra mess into the equation: ModuleA and ModuleB are actually defined in a separate (JBoss Seam Web App) project.

Any help would be wonderful! Thank you!


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.