How to get real className from a Lazy bean in Java

I'm working a lot with java reflection, and i'm using a map to store metadata from each bean in the application. I use the className as a key, so, the problem is that when a ask for the className of a bean). bean.getClass().getName() I can get two different results, depending if the bean is lazy loaded or not (some relations are lazy, some aren't, but i want to work with both of them. For example, the Class: package com.factorit.beans;
public class Task implements { If called in a normal loaded object, it returns: com.factorit.beans.Task but if called in a lazy initialized object, it returns com.factorit.beans.Task$$EnhancerByCGLIB$$f9d61939 I was wondering if there is a way to get this, or if I have to parse the String. Thank you so much for any help or advice. **EDIT:** Just to add some info: My Lazy annotattions look like this: @javax.persistence.ManyToOne(fetch = javax.persistence.FetchType.LAZY) and I'm using Struts, Hibernate 3 and Spring 2.5.6.

以上就是How to get real className from a Lazy bean in Java的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准