Announcement Announcement Module
Collapse
No announcement yet.
spring+hibernate+hessian Lists problem (again?) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • spring+hibernate+hessian Lists problem (again?)

    I'm sure that many other people must experience the problem of not being able to return lists of objects created by getHibernateTemplate() to a remote client via Hessian - they end up as an ArrayList of Hashmaps. I have seen a few solutions on the web but do not seem to be able to get any of them to work for me. I am not running Spring or Hibernate on the client just Hessian.

    Can anyone tell me what the current "standard" solution to this problem is? Or should it all work out-of-the-box and I'm just doing it wrong?

    I am using Spring 1.1.15 and the Hessian and Hibernate jars that come with it.

  • #2
    lists of objects created by getHibernateTemplate() to a remote client via Hessian - they end up as an ArrayList of Hashmaps.
    That's a weird one. Does the hashmap look like the column name and values of each row?

    Can you force your List into an Object[] array and then transmit that via hessian?

    Comment


    • #3
      Since I posted I have changed to return an Object[]...

      public Object[] findCatalogues() throws DataAccessException {
      return getHibernateTemplate().find("from Catalogue catalogue").toArray();
      }
      ... but I still have the same problem/result. The HashMap has an entry for each column in the table, the key is the column name and the value is the value of the column/row. One entry in the Object[] for each row.

      For the time being, I am just creating the required object from the parts but I cannot believe there isnt a better way.

      Comment


      • #4
        Do you have any lazy relationships in that object? Perhaps they aren't being loaded up.

        By "return an Object[]" I mean more of a "return a Foo[]" where Foo is your object, so that you're forcing your getHibernate() results into an array of the same type as what you expected to get back from the query.

        Comment

        Working...
        X