tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "mark.cavender" <>
Subject One to Many Relationship with Johnzon
Date Wed, 12 Oct 2016 13:31:09 GMT

I'm trying to map a one to many relationship with Johnzon.  I have a User
class the points to an array of Role, as follows.

Class User {

String userName;

List<Role> roles = new ArrayList<>();

@JohnzonConverter( RoleAdapter.class)
public List<Role> getRoles() {

  return roles;


Class Role {
  String name;
  List<User> users;

  public List<User> getUsers() {
    return users;

I then have a converter defined as follows:

public class RoleAdapter implements Converter<Role> {

    public String toString( final Role v ) {

        return v.getId().toString();

    public Role fromString( final String v ) {

        Role ri = new Role();
        ri.setId( Long.valueOf( v ) );
        return ri;


I am trying to convert the list of a java object to an array of Strings of
the ID of that object.  The problem is that my Converter never gets called. 
I have tried moving the converter to the declaration as well, but it doesn't
seem to matter.  Is there something that needs to be done to register a
Converter with Johnzon?

Thanks in advance,


View this message in context:
Sent from the TomEE Users mailing list archive at

View raw message