Announcement Announcement Module
Collapse
No announcement yet.
duplicate id - bug Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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

    Comment

    Working...
    X