Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Lookup Singelton to client problem

 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a class




And the Lookup Class is



Here is one class that Implements the AbstractFactory



So in the server side I create one of these and put it into a Map that I return to the client. The Map key is the DiscountTypeLookup.class and the value is the lookup object within the AbstractLoopkup.

When I get it on the client it is seeing that the DiscountTypeLookup class has the loadData method with code, which include Hibernate classes.

Even though I can never call the loadData method on the client, since we use the Class jsut to get the value out, in which the value class is of Type Lookup, which implements the ILookup interface. So the client gets the value out and assigns it to a reference of type ILookup, and that is all it can call methods on, is methods defined in that interface.

OK here is my problem, it is giving me a ClassDefNotFound exception on the Hibernate classes on the client. These classes are not on the client and should not be.

How can I get around this problem.

I hope I was clear enough in my explanation.

Thanks

Mark
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, here is the solution.

Instead of using the DiscountTypeLookup.class as the key I am using the RetailDiscount.class.getName() instead. So I use the String value of the DTOs class name.

Mark
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic