Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JBoss User Help »

[jboss-user] [EJB 3.0] - Re: Joined Inheritance Strategy Problem

scott.stark@jboss.org

2007-08-10


Hibernate only uses the discrimnator value if it is really needed (single table strategy). Since the class type for the strategy joined is clear by itself the discriminator value will be null. You can use the following hack to work around this:


|  /*
|   * This is workaround for a hibernate bug:
|   * -> http://opensource.atlassian.com/projects/hibernate/browse/ANN-140?page=all
|   */
|  @Column(name="DISCRIMINATOR",length=31)
|  public String getDiscriminatorValue() {
|    DiscriminatorValue discriminatorValueAnnotation = this.getClass().getAnnotation(DiscriminatorValue.class);
|    if (discriminatorValueAnnotation != null) {
|      return discriminatorValueAnnotation.value();
|    }
|    return this.getClass().getSimpleName();
|  }
|  
|  public void setDiscriminatorValue(String dummy) {
|  }
|

You will have to tweak it to use an integer as the discriminator value.

Regards

Felix

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

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4072913
_______________________________________________
jboss-user mailing list
jboss-user@(protected)
https://lists.jboss.org/mailman/listinfo/jboss-user
©2008 junlu.com - Jax Systems, LLC, U.S.A.