Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Annotate entity dataMember as pk

 
Sharon whipple
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to use entity date member as part of my PK?

For example:

 
Mike Keith
author
Ranch Hand
Posts: 304
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I get the feeling that your example is trivializing something that you are trying to do but not really specifying what it is. What you want to do is probably possible, just not the way you are doing it.

If you just want to have a class that includes the components of your pk then you can use either an IdClass or EmbeddedId. If you want to have a related entity as part of the id of another entity then create a relationship and an additional field containing the raw PK type of the first entity. One the two should be mapped as read-only.
 
Sharon whipple
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found the EmbeddedId few days ago, and it's exactly what I needed, and this solution is working great!!

The sample was trivial just because I wanted to focus on the real issue.

Thank you
Sharon


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic