• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

NoSuchMethodError with ManyToMany and ManyToOne

 
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Greetings,

I'm using EJB 3 annotations with JBoss and I have a strange problem:
Suppose that I have two classes, A and B.
Suppose that I have a ManyToOne from A to B, bidirectional.
If I try to invoke A.getB(), I get a NoSuchMethodError.
So, I tried to check the methods of my class and results that getB() returns java.lang.String, and NOT B. So, using ejbQL, I can read this field, but as string ("select a.B from A a" -> List<String> .

The strange thing is that the A.getClass() method gives the correct class name and B.getAs() returns correctly a List<A>.




I get a similar problem when I create a many-to-many unidirectional from A to B: in this case, no such List<B> getB() method results in A, so that I get a NoSuchMethodError, as above.

Thanks a lot in advances!

P.S. I'm working with JBoss 4.2.0
 
Mirko Bonasorte
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I've also tried with a simple OneToOne unidirectional.
The result is the same.

Watching the jboss logs, it seems that it completely ignores the getter method for the OneToOne.

Here it's the stuff:



In this situation, Ricetta.getPreparazione() invocation gives 'NoSuchMethodError'. Moreover, in JBoss logs, nothing is found about my 'preparazione' property.

Thanks a lot!
 
Mirko Bonasorte
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's it!
The problem was that, for previous experiments, I had deployed an old version of my persistence unit, where my classes had no one-to-one/many-to-one.
Removing it, all went ok!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic