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

Add static method EntityHome.wrapInstance and add location for update/persist processing

    Details

    • Type: Feature Request
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.1.1.GA
    • Fix Version/s: None
    • Component/s: Tools
    • Labels:
      None
    • Environment:

      Any

      Description

      Constructing an EntityHome object really doesn't provide a completely-initialized object. I needed to create EntityHome objects around existing @Entity objects. Once created, these objects can be saved in the database. I created a new static method in the code generated by EntityHome. It's called wrapInstance and , in use, is defined as:

      static public MyTblHome wrapInstance(MyTbl dat);

      If there's an id in the MyTbl instance, it is used. Otherwise, an id is created and used.

      I also changed update and persist:

      If we get there with a null instance, it's an error so we return "invalid".

      There are commented locations for pre- and post-update code. For example, the code can automatically save the ID of the user performing an update.

      There's a catch for validation errors (hibernate InvalidStateException instances). If one is found, all InvalidValue lines are logged and captured foe message output.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                vgriffin Valerie Griffin
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated: