2 Replies Latest reply on Jan 31, 2007 4:30 AM by David G.

    Serializable is needed

    David G. Newbie

      Hi all, I have a question about JPA's entities (with hibernate as JPA provider)
      Why do they need to implement Serializable interface?

      I'm getting a "NoSerializableException" when working with some entities (not all, unfortunately)

      Thanks :)

        • 1. Re: Serializable is needed

          Well, you need to implement Serializable when you want to use them in a context that requires serialization. :)

          There are a few places you could potentially need a serializable object. What exactly are you doing that causes you to run into the exception.

          • 2. Re: Serializable is needed
            David G. Newbie

            I'm trying to outject a new "Category" instance from a method markes as a factory method.

            "Category" is my entity POJO.

            Category selectedCategory;

            This is my factory method:

            public void CategoryViewer() {
            selectedCategory = (Category)em.createQuery("from Category c where id = :categoryId").setParameter("categoryId", categoryId).getSingleResult();

            So whenever I want to write an object to a Seam context, it has to be Serializable...

            Thanks Norman!