xxxxxxxxxx
@Entity
public class Example {
@Id long id;
// ....
@ElementCollection
@MapKeyColumn(name="name")
@Column(name="value")
@CollectionTable(name="example_attributes", joinColumns=@JoinColumn(name="example_id"))
Map<String, String> attributes = new HashMap<String, String>(); // maps from attribute name to value
}
xxxxxxxxxx
const { data } = useMyQuery({
variables: { id },
skip: !id
})
// will not run unless id is populated. You can populate id when button is clicked