• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Data type of a DB column to store a List<SomeClass> data structure.

 
kamal krishna bhatt
Ranch Hand
Posts: 41
Eclipse IDE Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi i am having a table say operations with fields - id,name,description ,
now i want to create another table roles with fields id,name ,permitted_operations and in permitted_operations field there should be a List<Operations> what should be the datatype of field permitted_operations.
 
ntumba lobo
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To me it looks like more a database design issue.

In your case I would just have a
-ROLE table with ID, NAME columns
-OPERATION table with ID, NAME, DESC columns
-ROLE_OPERATION table with ROLE_ID,OPERATION_ID. Both columns being foreign keys to ROLE and OPERATION table.

And with the appropriate mapping (many-to-many) you will have your java field with a List<Operation>

  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic