-->
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.  [ 8 posts ] 
Author Message
 Post subject: Fake properties excepted for mappedBy value
PostPosted: Wed Oct 05, 2005 2:07 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
I am able to navigate across a relationship that has been mapped w/ the following. Would it be possible to have H throw an error in these case?

Code:
@OneToMany(mappedBy="Derek Zoolander -1 ~", cascade = CascadeType.ALL, fetch = FetchType.LAZY)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 06, 2005 4:31 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
put in annotations jira....(Dennis, this is getting pretty annoying to write everytime you have genuine bugs/issues ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Re: Fake properties excepted for mappedBy value
PostPosted: Thu Oct 06, 2005 1:26 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
dennisbyrne wrote:
I am able to navigate across a relationship that has been mapped w/ the following. Would it be possible to have H throw an error in these case?

Code:
@OneToMany(mappedBy="Derek Zoolander -1 ~", cascade = CascadeType.ALL, fetch = FetchType.LAZY)


You're wrong, HA does raise an exception in this case
org.hibernate.MappingException: property not found: Derek Zoolander -1 ~

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 06, 2005 9:59 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
Code:
      Class clazz = ((Waterbdy)unit).getClass();
      log.info("The One side is " + clazz.getName());
      Method[] methods = clazz.getMethods();
      for(int m = 0 ; m < methods.length;m++){
         Method method = methods[m];
         Annotation[] annotations = method.getAnnotations();
         for(int a = 0 ; a < annotations.length; a++){
            Annotation annotation = annotations[a];
            if(annotation instanceof OneToMany){
               OneToMany one2many = (OneToMany) annotation;
               log.info(method.getName() + " -> " + one2many.mappedBy());
            }
         }
      }
      
      Configuration conf = Hibernate3Util.getConfiguration();
      PersistentClass pClazz = conf.getClassMapping(clazz.getName());
      if(pClazz.getClassName().equals(clazz.getName())){
         log.info("... and yes, it's a persistent class ");
      }else{
         log.info(" gee, I guess I am wrong");
      }



Code:
INFO  gov.blm.ak.arims.backing.crud.WaterbdyCrudBacker - The One side is gov.blm.ak.arims.model.Waterbdy
INFO  gov.blm.ak.arims.backing.crud.WaterbdyCrudBacker - getSites -> site
INFO  gov.blm.ak.arims.backing.crud.WaterbdyCrudBacker - getReaches -> Derek Zoolander -1 ~
INFO  gov.blm.ak.arims.backing.crud.WaterbdyCrudBacker - ... and yes, it's a persistent class


and I get no exceptions calling getReaches() .


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 07, 2005 5:47 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Hibernate3Util.getConfiguration().buildMappings();
otherwise the second pass is not launched in the configuration

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 07, 2005 10:38 am 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
secondPassCompile is also called by buildSessionFactory . the code above fires long after this.

is it possible you are talking about a feature that is in head, but not in the beta5 release? we can end it now you know?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 07, 2005 11:06 am 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
and yes, the release number should have been in the original post.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 10, 2005 4:47 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
This behavior is stable for at least a couple of releases. Are yuou sure you don't swallow the exception somewhere. Take the HA test suite and change a mappedby, you'll see the exception

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 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.