-->
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.  [ 12 posts ] 
Author Message
 Post subject: Upgrade errors
PostPosted: Tue Dec 13, 2005 1:51 pm 
Beginner
Beginner

Joined: Wed Oct 01, 2003 3:47 pm
Posts: 44
Just upgraded to recently released Hib, HA, and HEM. Previously working code on the older versions now throws a class cast exception at: org.hibernate.cfg.PropertyInferredData.extractType. Here's the trace. No changes have been made to the code since it was working in previous versions of hibernate. Any ideas on where to look?

---
09:36:54,428 INFO [AnnotationBinder] Binding entity from annotated class: java.lang.Class
09:36:54,435 INFO [EntityBinder] Bind entity com.brightmarket.core.member.Membership on table member_membership
09:36:54,491 WARN [ServiceController] Problem creating service jboss.j2ee:service=EJB3,module=bm-core.ejb3
java.lang.ClassCastException: java.lang.reflect.Method
at org.hibernate.cfg.PropertyInferredData.extractType(PropertyInferredData.java:187)
at org.hibernate.cfg.PropertyInferredData.execute(PropertyInferredData.java:114)
at org.hibernate.cfg.PropertyInferredData.skip(PropertyInferredData.java:57)
at org.hibernate.cfg.AnnotationBinder.addAnnotatedElement(AnnotationBinder.java:831)
at org.hibernate.cfg.AnnotationBinder.addElementsOfAClass(AnnotationBinder.java:808)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:641)
at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:266)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:199)
---


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 13, 2005 8:16 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
If your posting (or a question you are referring to) was not answered by anybody, the possible reasons are:

- http://www.hibernate.org/ForumMailingli ... AskForHelp
- You did not submit enough information
- Nobody knows the answer or has the free time to answer

What you can do now:

- Do the things listed in After Posting
- Add missing and/or more information
- Consider commercial support for guaranteed expert response times

This is a high-traffic forum run by volunteers with hundreds of postings made every day. The community works because people try to help others in their free time. Nobody is paid for this service or has to pay.

You should not expect a timely response and you should not rely on a public community forum for critical cases.

All community members should respect the rules of this forum and treat others like they would prefer to be treated.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 13, 2005 8:19 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
in other words, there is no enough info in your post, please use the template

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 13, 2005 8:26 pm 
Beginner
Beginner

Joined: Wed Oct 01, 2003 3:47 pm
Posts: 44
I appreciate the response, but I'm honestly not sure what additional information to provide. That's pretty much the point of the post.

The annotation setup has been working for quite some time on the previous versions of HA, HEM, hibernate. An upgrade to recently released version throws the exception:

"java.lang.ClassCastException: java.lang.reflect.Method
at org.hibernate.cfg.PropertyInferredData.extractType(PropertyInferredData.java:187)"

I've looked at the code in PropertyInferredData.java, but seem to be missing something in diagnosis.

Perhaps if you could tell me what it is trying to do on that line, I could compare it to my code.

Is it trying to figure what type of class a getter returns, and is bailing out for because it finds a java.lang.reflect.Method instead?

Ryan


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 13, 2005 8:33 pm 
Beginner
Beginner

Joined: Wed Oct 01, 2003 3:47 pm
Posts: 44
In other words, I'm humbly requesting more information on what your code is trying to do on that line, so that I can further investigate the problem on my own.

Ryan


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 13, 2005 8:57 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Show me the Membership code, this seems to be the offending one.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 13, 2005 10:54 pm 
Beginner
Beginner

Joined: Wed Oct 01, 2003 3:47 pm
Posts: 44
By adding debug output to that class (PropertyInferredData), I was able to narrow down which method it is crashing on.

Since I only printed the method name it crashes on (getData), it is one of these two methods on Membership:

Code:
@Transient
public Data getData(){..}

OR

@Transient
public <T extends MembershipData> T getData(Class<T> membershipDataType){...}


This code has seen no changes since it was working on the previous versions. Does that help?

Ryan


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 13, 2005 11:38 pm 
Beginner
Beginner

Joined: Wed Oct 01, 2003 3:47 pm
Posts: 44
Furthermore, I uncommented your line in PropertyInferredData.execute:

returnedClass = method.getReturnType();

which is how the previous versions retrieved this information. By uncommenting this line, and commenting the new stuff that calls "extractType", everything works perfectly again.

Ryan


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 14, 2005 6:01 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Change in the execute() method
Code:
if ( ! annotable ) {
            skip = true;
            processed = true;
            return;
         }
         


by

Code:
if ( ! annotable || annotedElt.isAnnotationPresent( Transient.class ) ) {
            skip = true;
            processed = true;
            return;
         }
         

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 14, 2005 2:58 pm 
Beginner
Beginner

Joined: Wed Oct 01, 2003 3:47 pm
Posts: 44
Yes, that fixed the problem with the Membership class. Its previously discussed Transient methods (getData) are now ignored, and no exception is thrown.

However, now that we can proceed past Membership, a new problem has developed that ALSO did not exist in the previous version.

This new problem involves a generically typed entity, and throws the same exception as mentioned previously in this thread. I've included the entity source below -- all three getters throw that exception.

When using:

Code:
returnedClass = method.getReturnType();


instead of extractType, everything works perfectly with regards to this generic entity.

Please let me know if you need additional information.

Code:
@Entity(name="LifecycleHistory")
@Table(name="workflow_lifecycle_history")
public class LifecycleHistory<STATE extends Enum, REASON extends Enum> extends Model{
   private static final long serialVersionUID = -8445979354786791933L;

   private STATE previousLifecycle;
   private STATE newLifecycle;
   private REASON newLifecycleReason;
   
   @Column(name="new_lifecycle")
   @NotNull
   @Type(type="StringEnum")
   public STATE getNewLifecycle() {
      return newLifecycle;
   }

   public void setNewLifecycle(STATE lifecycle) {
      this.newLifecycle = lifecycle;
   }
   
   @Column(name="new_lifecycle_reason")
   @Type(type="StringEnum")
   public REASON getNewLifecycleReason() {
      return newLifecycleReason;
   }

   public void setNewLifecycleReason(REASON lifecycle) {
      this.newLifecycleReason = lifecycle;
   }
   
   @Column(name="previous_lifecycle")
   @Type(type="StringEnum")
   public STATE getPreviousLifecycle() {
      return previousLifecycle;
   }

   public void setPreviousLifecycle(STATE previousLifecycle) {
      this.previousLifecycle = previousLifecycle;
   }   
}


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 19, 2005 7:45 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
provide a miunimal test case I'll have a look

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 19, 2005 12:20 pm 
Beginner
Beginner

Joined: Wed Oct 01, 2003 3:47 pm
Posts: 44
I'm afraid I don't have time to do that right now. I guess I'll have to keep patching PropertyInferredData back to:

returnedClass = method.getReturnType()

to correct these two newly introduced bugs in the meantime. Your previous behavior was much more forgiving, evidently.

Thanks,

Ryan


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