Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 284017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T05:25:21+00:00 2026-05-12T05:25:21+00:00

I have a JSF converter that I use for a SelectItem list containing several

  • 0

I have a JSF converter that I use for a SelectItem list containing several different entity types. In the getAsString() method I create the string as the class name suffixed with “:” and the ID.

MySuperClass superClass = (MySuperClass)value;
if(superClass != null) {
  return String.valueOf(superClass.getClass().getName()+":"+superClass.getId());
}

This allows me to load the correct entity in the getAsObject() on the way back from the UI by doing this :

String className = value.substring(0, value.indexOf(":"));
long id = Long.parseLong(value.substring(value.indexOf(":")+1));
Class<T> entitySuperClass = (Class<T>) Class.forName(className);
MySuperClass superClass = (MySuperClass)getEntityManager().find(entitySuperClass, id);

My problem is that my entity in getAsString() is a proxy. So instead of getting com.company.MyEntity when I do a getClass().getName() I am getting com.company.MyEntity_$$_javassist_48 so then it fails on the find().

Is there any way (aside from String manipulation) to get the concrete class name (eg. com.company.MyEntity)?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T05:25:22+00:00Added an answer on May 12, 2026 at 5:25 am

    Instead of superClass.getClass() try org.hibernate.proxy.HibernateProxyHelper.getClassWithoutInitializingProxy(superClass).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

All the tutorials I have seen seem to use *.jsf , *.faces , or
I am using JSF 2.0 btw I have an attribute X type Integer, that
I have a jsf page that contains some javascript includes. And I want to
I have a JSF 2.0 application running on GlassFish v3. It has EJBs that
In action method (JSF) i have something like below: public String getFile() { byte[]
In JSF, I have this: <h:selectManyListbox id=createAccountBasicInfo_select_Types styleClass=selectManyCheckbox value=#{party.roles} size=6 converter=persistenceObjectToStringTwoWayConverter> <f:selectItems value=#{accTypes.selectItems} />
Have JSF 1.2 two pages(one.xhtml and other.xhtml), that are included to the current page
If you have a JSF <h:commandLink> (which uses the onclick event of an <a>
In JSF is it possible to have a datatable displays records as follows? [Name
Is there any documentation about introducing jBoss seam to an old Hibernate/JSF project? Have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.