Uploaded image for project: 'Spring Roo'
  1. Spring Roo
  2. ROO-505

Need support for @EmbeddedId - a way to specify this in @RooEntity

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Complete
    • Affects Version/s: 1.0.0.RELEASE
    • Fix Version/s: 1.1.0.M3
    • Component/s: PERSISTENCE
    • Labels:
      None
    • Environment:
      Mac OS X -Snow Leopard, Java 6 - 1.6.0_17-b04-248-10M3025, STS 2.3.0

      Description

      I want to use @EmbeddedId in order to use composite primary key. e.g. I want to use the following

      [CODE]
      package com.synconx.entities;

      import java.io.Serializable;

      import javax.persistence.Column;
      import javax.persistence.Embeddable;

      /**

      • @Author Chiradip Mandal
      • @Copyright © Chiradip Mandal 2009
      • @License Apache License v2.0 http://www.apache.org/licenses/LICENSE-2.0
        *
        */
        @Embeddable
        public class EdgeId implements Serializable {
        private static final long serialVersionUID = 7709843884574764331L;
        @Column( name = "SOURCENODEID" )
        private long sourceNodeID;
        @Column( name = "TARGETNODEID" )
        private long targetNodeID;

      public EdgeId() {
      }

      public EdgeId( long sourceNodeID, long targetNodeID )

      { this.sourceNodeID = sourceNodeID; this.targetNodeID = targetNodeID; }

      public long getSourceNodeID()

      { return sourceNodeID; }

      public void setSourceNodeID( long sourceNodeID )

      { this.sourceNodeID = sourceNodeID; }

      public long getTargetNodeID()

      { return targetNodeID; }

      public void setTargetNodeID( long targetNodeID )

      { this.targetNodeID = targetNodeID; }

      @Override
      public boolean equals( Object o ) {
      if ( o instanceof EdgeId )

      { EdgeId that = ( EdgeId ) o; return ( this.sourceNodeID == that.sourceNodeID ) && ( this.targetNodeID == that.targetNodeID ); }

      return false;
      }

      @Override
      public int hashCode()

      { return new Long( sourceNodeID ).hashCode() + new Long( targetNodeID ).hashCode(); }

      }
      [/CODE]

      No I want to have roo managed entity Edge that looks like the following now

      [CODE]
      @Entity
      @Table( name = "EDGE" )
      public class Edge implements Serializable {
      private static final long serialVersionUID = 6090794895049089364L;

      @Column( name = "EDGETYPE" )
      private EdgeType edgeType;

      public EdgeType getEdgeType()

      { return edgeType; }

      public void setEdgeType( EdgeType edgeType )

      { this.edgeType = edgeType; }

      @EmbeddedId
      private EdgeId edgeId;

      public EdgeId getId()

      { return edgeId; }

      public void setId( EdgeId id )

      { this.edgeId = id; }

      public EdgeId getEdgeId()

      { return edgeId; }

      public void setEdgeId( EdgeId id )

      { this.edgeId = id; }

      }
      [/CODE]

      I want it in the following way

      [CODE]
      @RooEntity(identifierType = EdgeId.class, embeddedIdentifier = true)
      @Entity
      @Table( name = "EDGE" )
      public class Edge implements Serializable {
      private static final long serialVersionUID = 6090794895049089364L;

      @Column( name = "EDGETYPE" )
      private EdgeType edgeType;
      }
      [CODE]

      In the @RooEntity - it is great to have something called embeddedIdentifier with true and false options, false being the default option.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                stewarta Alan Stewart
                Reporter:
                chiradip Chiradip Mandal
              • Votes:
                15 Vote for this issue
                Watchers:
                10 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: