开发者

How Do Hibernate Composite Keys Affect Property Access?

开发者 https://www.devze.com 2023-03-27 15:36 出处:网络
This is a high level question that I haven\'t been able to wrap my google abilities around. I\'ve got an Access table that maps rights to pieces of data to users.The table contains an id for the user

This is a high level question that I haven't been able to wrap my google abilities around.

I've got an Access table that maps rights to pieces of data to users. The table contains an id for the user, an id for the data, and a code for the right. According to the schema these three fields make up the primary key.

I will likely be accessing the data from a set from either the user or the data and will not likely have to grab any of the AccessControlLists myself. After the set operation, I'm only interested in the pairs that come out (either {user,right} or {data,right}).

Normally I'd make a composite id, but then I'd have to go through extra effort every time I wanted to get these two simple fields.

Am I able to specify these fields as properties as well? Or can someone think of a way that I could continue to provide simple access to these fields that开发者_开发知识库 may by part of a composite-id.

Edit: I'm working under the possibly incorrect assumptions that:

  • I need a hibernate ID for every table
  • I cannot have a column be both a property and an id
0

精彩评论

暂无评论...
验证码 换一张
取 消