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

  • SEARCH
  • Home
  • 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 7973853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:13:16+00:00 2026-06-04T08:13:16+00:00

Im trying to create a Value Proxy (BrowserDetailItem ) that is formed of a

  • 0

Im trying to create a Value Proxy (BrowserDetailItem ) that is formed of a query that only returns a String(name) and a Integer(id).

The SERVER code (each class in a different files)

public class BrowserDetailItem {

    private String name;
    private Integer id;

    public static EntityManager entityManager() {
        return (new UnitPersistence()).get();
    }

    BrowserDetailItem() {
    }

    BrowserDetailItem(String name, Integer id) {
        this.name = name;
        this.id = id;
    }

    public String getName() {

        if (name == null)
            return "";
        else
            return name;
    }

    public Integer getId() {

        if (id == null)
            return null;
        else
            return id;
    }

    public static List<BrowserDetailItem> getBrowserFilterList() {

        EntityManager entityManager = entityManager();
        try {

            List<BrowserDetailItem> tempList = new ArrayList<BrowserDetailItem>();

            Query query = entityManager
                    .createQuery("SELECT s.name,s.id FROM Song s, Playlist p, Composer c "
                            + "WHERE s.id_playlist = p.id AND c.id = p.id_composer ");

            tempList = query.getResultList();
            tempList.size();

            return tempList;

        } catch (Exception e) {
            return null;
        } finally {
            entityManager.close();
        }

    }
}
public class BrowserDetailItemDAO {

    public void save(BrowserDetailItem browserItem) {
    }

    public BrowserDetailItem findById(Integer id) {
        return null;
    }
}



public class BrowserDetailItemLocator extends
        Locator<BrowserDetailItem, Integer> {

    @Override
    public BrowserDetailItem create(Class<? extends BrowserDetailItem> clazz) {
        return new BrowserDetailItem();
    }

    @Override
    public BrowserDetailItem find(Class<? extends BrowserDetailItem> clazz,
            Integer id) {
        return getBrowserDetailItemDao().findById(id);
    }

    private BrowserDetailItemDAO getBrowserDetailItemDao() {
        return new BrowserDetailItemDAO();
    }

    @Override
    public Class<BrowserDetailItem> getDomainType() {
        return BrowserDetailItem.class;
    }

    @Override
    public Integer getId(BrowserDetailItem domainObject) {
        return domainObject.getId();
    }

    @Override
    public Class<Integer> getIdType() {
        return Integer.class;
    }

    @Override
    public Object getVersion(BrowserDetailItem domainObject) {
        // return domainObject.getVersion();
        return null;
    }

}

The SHARED code (each class in a different files)

@ProxyFor(value = BrowserDetailItem.class, locator = BrowserDetailItemLocator.class)
public interface BrowserDetailItemProxy extends ValueProxy {

    public String getName();

    public Integer getId();

}

@Service(BrowserDetailItem.class)
public interface BrowserDetailItemRequest extends RequestContext {

    Request<List<BrowserDetailItemProxy>> getBrowserFilterList();
}

I did all the wiring acording to the developer guide and http://cleancodematters.com/2011/06/04/tutorial-gwt-request-factory-part-i/

The code executes (returns the query and assigns the results to a list) up to the return of getBrowserFilterList() then I get the following error:

com.google.web.bindery.requestfactory.server.UnexpectedException: The domain type java.lang.Object[] cannot be sent to the client.

What am I doing wrong? please help

  • 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-06-04T08:13:17+00:00Added an answer on June 4, 2026 at 8:13 am

    Solved it.

    The problem was in: tempList = query.getResultList();

    The result list returned from the query is a List<Object[][]> which couldn’t be converted to List<BrowserDetailItem>.

    This meant that the return method instead of returning a List<BrowserDetailItem> which is a ValueProxy, returned a List<Object[][]> which can’t be sent to the server.

    The solution was to iterate though the List and create a new BrowserDetailItem in each pass:

         Query query = entityManager 
                .createQuery("SELECT s.name,s.id FROM Song s,  Playlist p, Composer c WHERE s.id_playlist = p.id AND c.id = p.id_composer "); 
    
            List results = query.getResultList(); // Fetches list containing arrays of object
    
            Iterator it = results.iterator();
    
            while (it.hasNext()) {
    
                Object[] result = (Object[]) it.next(); // Iterating through the array object
    
                tempList.add(new BrowserDetailItem ((String) result[0], (Integer) result[1]));
            }
    
            tempList.size();
    
            return tempList;
    

    I Also removed the locator was pointless because no persistence was required.

    Hope it helps.

    Thx Sam

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

Sidebar

Related Questions

I am trying to create a function that updates another value, and initially (after
I am trying to create a dynamic hyperlink that depends on a value passed
I'm trying to create text in html, that once clicked, the the value of
I am trying to create a table with values that are in a String
I am currently trying to create a REST proxy that calls a WCF SOAP
I am trying to create a name,value pair in Hibernate which gets returned as
I am trying to create a Hash that has as its value an array.
I am trying to create multiple items (each with a name value and a
I am trying to create a rails application that assigns one value to a
I am trying to make a proxy server that gets a page from www.xxx.com

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.