| 
					
						 I have this problem:
 
 inherhitance tree:
 
 PersistentObject
     |
     | - Agent
       | 
       | - User
       | - Group
 
 
 the project was built with lazy='false' everywhere in the mappings.
 So you can image the performance of it... now i have to improve this system, and the time is short.
 
 First thing i did was to set all lazy as true, but this implied in a lot of problems (most involved with polimorphism and instanceof).
 
 I have in one place, one problem, that reproces itself everywhere on the system, its the following:
 
 i need to do a instanceof of one Agent, and then cast it to User or Group
 with lazy='false' this works perfectly
 but with lazy='true' i get:
 
 java.lang.ClassCastException: com.company.project.model.Agent$$EnhancerByCGLIB$$71276b45
 
 the object is not User neither Group
 Its proxying the Agent
 
 BEST SOLUTION I CAN THINK:
 
 is there any way the proxy override the right instance?
 so when i print the object i get com.company.project.model.User$$EnhancerByCGLIB$$71276b45 or com.company.project.model.Group$$EnhancerByCGLIB$$71276b45
 
 I apreciate the time spent to read this 
					
  
						
					 |