Results 1 to 2 of 2

Thread: duplicate id - bug

  1. #1

    Default duplicate id - bug

    Hi,

    Code:
    install jpa -provider HIBERNATE -database MYSQL
    add dependency -groupId javax.annotation -artifactId jsr250-api -version 1.0
    
    new persistent class jpa -name ~.domain.UserAccount
    add field string username
    add field string password
    add field boolean accountNonExpired
    add field boolean accountNonLocked
    add field boolean creadentialsNonExpired
    add field boolean enabled
    
    new persistent class jpa -name ~.domain.UserRole
    add field string name
    add field string description
    add field boolean enabled
    
    new persistent class jpa -name ~.domain.Resource
    add field string name
    add field string description
    add field boolean enabled
    
    add field set jpa -class ~.domain.UserAccount -fieldName roles -element ~.domain.UserRole
    add field set jpa -class ~.domain.UserRole -fieldName resources -element ~.domain.Resource
    
    new controller automatic -name ~.web.UserAccountController -formBackingObject ~.domain.UserAccount
    new controller automatic -name ~.web.UserRoleController -formBackingObject ~.domain.UserRole
    new controller automatic -name ~.web.ResourceController -formBackingObject ~.domain.Resource
    
    configure logging -level DEBUG -package WEB
    install security
    When I'm trying to add more then 2 UserRole to UserAccount then mysql throws exception about duplicating id. Is there any solution to make it work ?

  2. #2
    Join Date
    Mar 2008
    Location
    Sydney, AU
    Posts
    974

    Default

    Yes this is a known issue with Hibernate. See ROO-187 for details. In short, Hibernate applies the unique constraint to the colums in the table that connects your related entities. We are looking into workarounds, in the meantime you could try to use openJpa.

    HTH,
    Stefan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •