Announcement Announcement Module
Collapse
No announcement yet.
Composite Key - the @IdClass support Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Composite Key - the @IdClass support

    we have a code generation tools in our project, and when i tried to migrate them to work with ROO, there's some problem.
    the entity we generated when there's a composite key just like this:
    Code:
    @Entity
    @RooJavaBean
    @RooToString
    @RooEntity
    @IdClass(AbcPK.class)
    public class Abc {
    	@Id
    	@Column
    	private String pk1;
    	@Id
    	@Column
    	private String pk2;
    	@Column
    	private String name;
    	@Column
    	private Integer count;
    }
    the @RooEntity can't recognize the @IdClass annotation and can't work well, so what should we do? thanks.

  • #2
    There is an 'identifierType' attribute on the @RooEntity (I suggest checking the sources/javadoc). Also the Entity you now have is invalid as there can be just 1 @Id annotation.

    Comment


    • #3
      Originally posted by Marten Deinum View Post
      There is an 'identifierType' attribute on the @RooEntity (I suggest checking the sources/javadoc). Also the Entity you now have is invalid as there can be just 1 @Id annotation.
      if i specify the "identifierType" attribute, the RooEntity will generate an other field named "id" with the type i specified, it's not what i want.

      and the entity above is correct in JPA, and we need the composite key schema.

      Comment


      • #4
        Hmm you are right, I should keep a better track of the JPA compared to plain hibernate .

        I was also mistaken the @EmbeddedId (which I tend to use as I think it is more clear but that is IMHO).

        Not sure how to solve this one (I was hoping the solution suggested would fix it), I suggest adding a JIRA issue to add support for this.

        Comment


        • #5
          yes, we can't use the @EmbeddedId, either.

          Comment


          • #6
            https://jira.springsource.org/browse/ROO-505 for the benefit of the forum archive. We are aware of this request and will take it into account during our planning for the next few releases.

            Comment


            • #7
              but what about the @IdClass ?

              Comment


              • #8
                It would be good if you could comment on the Jira issue, so we can take into account all the relevant requirements and not overlook any when we implement it.

                Comment

                Working...
                X