3 Replies Latest reply on Mar 20, 2008 9:30 AM by mazz

    Force update on particular column

    adastar

      Is there a way to force JBoss to update a particular column/field on a CMP Entity Bean, even if it isn't dirty/modified?

        • 1. Re: Force update on particular column
          adastar

          no ideas?

          • 2. Re: Force update on particular column
            mazz

            "CMP Entity Bean"? Is this a EJB 2.x question or a EJB3/JPA entity question? I'll assume the latter due to this forum being "EJB 3.0".

            See entityManager.merge() - it merges an unattached JPA entity bean meaning whatever values are in the bean will be put into the DB. It doesn't merge one particular field - the entire bean is merged. I don't know of a way to force only a single field (dirty or not) to be merged into the DB - I don't think its possible, short of you writing your own JPQL UPDATE query and executing that explicitly.

            • 3. Re: Force update on particular column
              mazz

              I slightly misspoke - entityManager.merge() can merge either an attached or unattached JPA entity bean (it doesn't just have to be unattached).