Questions tagged «jointable»

3
用多余的列映射多对多关联表
我的数据库包含3个表:User和Service实体具有多对多关系,并按如下所示与SERVICE_USER表联接: 用户-SERVICE_USER-服务 SERVICE_USER表包含附加的BLOCKED列。 执行这种映射的最佳方法是什么?这些是我的实体类 @Entity @Table(name = "USERS") public class User implements java.io.Serializable { private String userid; private String email; @Id @Column(name = "USERID", unique = true, nullable = false,) public String getUserid() { return this.userid; } .... some get/set methods } @Entity @Table(name = "SERVICES") public class CmsService implements …

4
生成迁移-创建联接表
我经历了许多期待SO和google职位产生连接表的迁移has many and belongs to many协会并没有什么工作。 所有解决方案都生成一个空的迁移文件。 我正在使用rails 3.2.13,我有两个表:security_users和assignments。这些是我尝试过的一些事情: rails generate migration assignments_security_users rails generate migration create_assignments_security_users rails generate migration create_assignments_security_users_join_table rails g migration create_join_table :products, :categories (following the official documentation) rails generate migration security_users_assignments security_user:belongs_to assignments:belongs_to 谁能说出如何在两个表之间创建联接表迁移?
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.