Uploaded image for project: 'Seam 2'
  1. Seam 2
  2. JBSEAM-3262

Allow entity class component to be assigned stateless scope

    Details

    • Workaround:
      Workaround Exists
    • Workaround Description:
      Hide

      Scope the prototype to the event scope, though then it is stored for the remainder of the request. This can be a problem depending on the usage scenario.

      Show
      Scope the prototype to the event scope, though then it is stored for the remainder of the request. This can be a problem depending on the usage scenario.

      Description

      There is no reason for not allowing an entity class component to be assigned to the stateless context like JavaBean and stateless session bean components. In fact, you could argue that there is no difference between a JavaBean and an entity class based on the fact that they are both vanilla Java classes.

      There is a perfect use case for this feature that comes right from the heart of Seam. When using the Home component, it is perfectly natural to create a component role for an entity class that is wired to the newInstance property to be used as a prototype. For instance, here is an example:

      <component name="roundPrototype" class="org.open18.model.Round" scope="stateless">
      <property name="golfer">#

      {currentGolfer}

      </property>
      <property name="date">#

      {currentDate}

      </property>
      </component>

      <framework:entity-home name="roundHome" class="org.open18.action.RoundHome" new-instance="#

      {roundPrototype}

      "/>

      You don't want the roundPrototype to be stored in a scope since it is only used internally to produce the instance managed by the roundHome component. However, with this configuration, Seam throws an exception at startup.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                pmuir Pete Muir
                Reporter:
                dan.j.allen Dan Allen
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 5 minutes
                  5m
                  Remaining:
                  Remaining Estimate - 5 minutes
                  5m
                  Logged:
                  Time Spent - Not Specified
                  Not Specified