YAML - one to many object plots

I use the snakeyaml parser (java) to write a test case and cannot figure out how to plot the graph correctly. Any help greatly appreciated. thank.

RuntimeException occured : Cannot load fixture test-data.yml: 
org.hibernate.PropertyAccessException: could not get a field value by 
reflection getter of models.Priority.description

the above exception applies to an unrelated field, and it works if I remove the association

roles: 
  - roleType: testRoleType 
    description: desc 

If I change it to

- !models.Role 
      roleType:         testRoleType 
      description: desc 

RuntimeException: Failed to load test-data.yml: null; Unable to build java object for! Models.Role; Exception = onRole Any help highly appreciated. Thank you

public class Person {
String fullname;

@OneToMany(cascade=CascadeType.ALL)
public List<Role> roles;
}

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

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


YAML--

RoleType (testRoleType):
    roleName:      test
    description:   desc

Person(administrator):
    fullname:       Administrator
    roles:
      - roleType: testRoleType
        description: desc
0
source share
1 answer

1) create your schedule

2) Use SnakeYAML to serialize the object:

JavaBeanDumper dumper = new JavaBeanDumper();
String output = dumper.dump(graph);

3) see what comes of it, and change it manually.

P.S.! models.Role - , SnakeYAML, .

+1

Source: https://habr.com/ru/post/1756796/


All Articles