This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Lookup Singelton to client problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Lookup Singelton to client problem" Watch "Lookup Singelton to client problem" New topic

Lookup Singelton to client problem

Mark Spritzler

Joined: Feb 05, 2001
Posts: 17249

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.



Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17249

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.

I agree. Here's the link:
subject: Lookup Singelton to client problem
Similar Threads
determine the input type of the value of the function parameter map
Template Method/Singleton with Factory
Generics are going to be the death of me.
Working with HashMap
Generics and Colletions