-
Hi, I know that it's possible to add a // Class fields
private ClassOne classOne;
private Set<ClassTwo> setOfClassTwo;
// Converters
@ElideTypeConverter(type = ClassOne .class, name = "ClassOneSerde")
public class ClassOneSerde implements Serde<String, ClassOne> {
// Implementation
}
@ElideTypeConverter(type = ClassTwo.class, name = "ClassTwoSerde")
public class ClassTwoSerde implements Serde<String, Set<ClassTwo>> {
// Implementation
} Are these serdes meant to work like that? I've tried it this way, the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Try this instead: // Class fields
private Set<ClassTwo> setOfClassTwo; // Converters
@ElideTypeConverter(type = ClassTwo.class, name = "ClassTwoSerde")
public class ClassTwoSerde implements Serde<String, ClassTwo> {
// Implementation
} |
Beta Was this translation helpful? Give feedback.
-
I would need to see your models to understand better what is going on. For an example of something that sounds like your use case, check out this test: That test produces a response like:
The company model looks like: @Entity
@Include
@Data
public class Company {
@Id
private String id;
private String description;
@Embedded
private Address address;
} and the Address class looks like: @Embeddable
@Data
public class Address {
private String street1;
private String street2;
@Column(name = "properties", columnDefinition = "TEXT")
@Convert(attributeName = "key", converter = MapConverter.class)
Map<Object, Object> properties;
} The |
Beta Was this translation helpful? Give feedback.
I would need to see your models to understand better what is going on. For an example of something that sounds like your use case, check out this test:
https://github.com/yahoo/elide/blob/master/elide-integration-tests/src/test/java/com/yahoo/elide/tests/ResourceIT.java#L657-L692
That test produces a response like: