org.hibernate.MappingException:实体用户映射中的重复列

org.hibernate.MappingException:实体用户映射中的重复列,hibernate,grails,Hibernate,Grails,还有其他类似的问题,但没有一个对我有帮助 我有一个外部数据库,表为“team”,列为“username”和“password”。 在我的Grails项目中,我希望正确映射我的用户类: class User { String username String passwordHash static mapping={ table 'team' version false passwordHash column

还有其他类似的问题,但没有一个对我有帮助

我有一个外部数据库,表为“team”,列为“username”和“password”。 在我的Grails项目中,我希望正确映射我的用户类:

class User {

     String username
     String passwordHash 

      static mapping={
         table 'team'
         version false
         passwordHash column: 'password' 
         id column: 'username'
      }
  }
我一直在为实体:用户列:用户名(应使用insert=“false”update=“false”进行映射)映射中获取MappingException:Repeated列


有什么想法吗?

如果显式使用列作为标识符,而不是grails提供的默认标识符
id
,则需要在自定义ORM映射中为
id
指定字段名称,如下所示:

class User {

 String username
 String passwordHash 

  static mapping={
     table 'team'
     version false
     passwordHash column: 'password' 
     id column: 'username', name: 'username'
  }
}