-->
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.  [ 6 posts ] 
Author Message
 Post subject: change in default DiscriminatorValue in beta9?
PostPosted: Wed Mar 22, 2006 9:49 pm 
Newbie

Joined: Fri Feb 10, 2006 2:57 am
Posts: 14
I've been playing around with Beta9 from SVN and noticed that the defaulting for DiscriminatorValue has changed. I'm not sure if this is a bug or a change to be spec compliant? Thre is a note in the code about being "spec compliant"

If its a change to be spec compliant, the documentation needs to be changed:
Quote:
The default name of the discriminator column is TYPE, and (for Hibernate) the default discriminator value is the fully qualified class name.
- http://www.hibernate.org/hib_docs/annot ... le/#d0e775

Looks like change in bindEntity():

From:
Code:
...
if ( StringHelper.isEmpty( discriminatorValue ) ) {
        persistentClass.setDiscriminatorValue( persistentClass.getEntityName() );
}
...


To:
Code:
...
bindDiscriminatorValue();
...


calls into

Code:
   public void bindDiscriminatorValue() {
      if ( StringHelper.isEmpty( discriminatorValue ) ) {
            ...
            persistentClass.setDiscriminatorValue( name ); //Spec compliant
            ...
   }


If the behavior is to be consistent, I'd think you'd want:
Code:
persistentClass.setDiscriminatorValue( persistentClass.getEntityName() )


because "name" is the unqualified name of the class. If this is spec compliant, an FAQ is probably in order.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 22, 2006 9:50 pm 
Newbie

Joined: Fri Feb 10, 2006 2:57 am
Posts: 14
speaking of Beta9, it's marked as released in Jira but not available as a packaged download yet, just available in SVN.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 25, 2006 9:30 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
The spec has changed in this are hence the change.
I'm waiting some JBoss release before pushing out beta9

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 29, 2006 1:39 am 
Newbie

Joined: Fri Feb 10, 2006 2:57 am
Posts: 14
spec change - right. Guess we'll have to live with it. Seems pretty dumb to me - if you had two classes with the same name but different packages, you'd break with the out-of-the-box configuration.

guess I will have to add more annotations to my classes to keep the desired behavior.

anyhow, thanks for the clarification.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 29, 2006 3:48 pm 
Beginner
Beginner

Joined: Tue Dec 09, 2003 3:27 pm
Posts: 21
I agree that this seems dumb, any possibility of Hibernate supporting an additional DiscriminatorType for fqcn?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 31, 2006 7:37 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
This is not dumb, fqcn required a huge column size.
Add a JIRA issue for flexible Hibernate dicriminator type.
this has nothing to dow ith the value though

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

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.