Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None

      Description

      At the moment, it is not possible to have null @Embedded objects in JPA (while Hibernate, etc allow it). This is quite a common scenario in most domain models that JPA should take into account. The following is an example:

      <pre>
      public class Employee {
      ...
      @Embedded(optional=true) // This should be possible since the employee entity can be null in some
      // stages of it's life-cycle
      private Address address;
      ...
      }
      </pre>

        Activity

        Hide
        neilstockton added a comment -

        Just using "optional" doesn't define how a JPA provider can distinguish between a NULL embedded object and an embedded object with null fields.

        The JDO spec provided a definition for this problem.

        "null-indicator-column" defines which column used by the embedded object is for determining a null object, and "null-indicator-value" defines the value in that column that means we have a null object. So then the JPA provider can persist this null value in the null column on persist of a null embedded object, and ditto when retrieving.

        Show
        neilstockton added a comment - Just using "optional" doesn't define how a JPA provider can distinguish between a NULL embedded object and an embedded object with null fields. The JDO spec provided a definition for this problem. "null-indicator-column" defines which column used by the embedded object is for determining a null object, and "null-indicator-value" defines the value in that column that means we have a null object. So then the JPA provider can persist this null value in the null column on persist of a null embedded object, and ditto when retrieving.

          People

          • Assignee:
            ldemichiel
            Reporter:
            reza_rahman
          • Votes:
            4 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated: