Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Combination of many-to-many and findAll

 
Kashif Nazar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Guys,

I am new to Hibernate and I am stuck in a problem. I have three tables.

USER

USER_ID
------------
1
2



FEATURE

FEATURE_ID
----------------
1
2
3
4
5
6


and the many-to-many table.

USER_FEATURE


USER_ID FEATURE_ID
------------|------------------
1.............|...............1
1.............|...............2


The problem is that the semantics of my scheme are different. User has access to all features (1,2,3,4,5,6). But the many-to-many table means which Features need attention. In other words, many-to-many table acts as a flag.

I want a method to which I can pass a user object. If I pass the user with USER_ID 1, the result should be 1(ON), 2(ON), 3(OFF), 4(OFF), 5(OFF), 6(OFF).


The Feature class will have two properties.

Feature
-----------
FeatureId
AttentionFlag (user-based)



Please help.
Thanks,

Kashif
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic