ActiveObjects: Collections of basic types for as fields?

Claudio Kirchhoff January 18, 2017

Hi there,

with hibernate there is a fairly straightforward way to have Collections of basic types as a type for the field of an entity. e.g. a field with the type of Set<String>.

See: http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html/collections.html#collections-ofvalues

I can't find any evidence that this is possible with activeObjects - is it?

Cheers

Claudio

1 answer

1 accepted

1 vote
Answer accepted
Volodymyr Krupach
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 18, 2017

Hi Claudio,

There is no something like ElementCollection/CollectionTable in AO,

Only way is to have parent-child DB relation and then in parent entity you have @OneToMany:

// I guess that reverse is optional if you only one relation between parent-child tables
@OneToMany(reverse = "getParentEntity")
public ChildEntity[] getChildEnitities();
Claudio Kirchhoff January 18, 2017

But ChildEntity would have to implement Entity, right? I.e. you couldn't do

@OneToMany
public String[] getNames()

could you? I have tried that of course, but I was wondering if I might just have missed something.

Thanks for your answer, btw smile

Volodymyr Krupach
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 19, 2017

But ChildEntity would have to implement Entity, right? 

 Right.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events