views:

27

answers:

1

Hello,
I am using Snakeyaml for building my domain graph. I couldn't find the right syntax for it. Please see the domain model, and the yaml.

public class Person { 
      String fullname; 
     @OneToMany(mappedBy="person",cascade=CascadeType.ALL) 
      public List<Role> roles; 
} 

public class Role { 
      public RoleType roleType; 
      public String description; 
      public Person person;
} 

public class RoleType { 
      public String roleName; 
      public String description; 
} 


YAML1:

RoleType(rt1):
    roleName:       ADMINISTRATOR
    description:    administrator

Role(prole1):
    roleType:       rt1
    description:      description

Person(person1):
    fullname:       test user
    roles:
      - role1

YAML2:

RoleType(rt1):
    roleName:       ADMINISTRATOR
    description:    administrator

Person(person1):
    fullname:       test user
    roles:
      - roleType:       rt1
        description:    description
        person:         person1

YAML3:

RoleType(rt1):
    roleName:       ADMINISTRATOR
    description:    administrator

Person: &1
    fullname:       test user
    roles:
      - roleType:       rt1
        description:    description
        person:         *1

None of it worked, giving transient error or "No previous reference found for object of type ..." . Any pointer, highly appreciated. thanks.