[hibernate-dev] Embedded value not null when it includes an @ElementCollection

Davide D'Alto davide at hibernate.org
Wed Sep 17 11:32:03 EDT 2014


Hi,
I've created a test for OGM where we store an @Embeddable containing a list
annotated with @ElementCollection [1]:

This is the embedded:

@Embeddable
public class PhoneNumber {

    private String main;

    @ElementCollection
    private List<String> alternatives;

...

}

In the test [2] I first save an entity with the embedded attribute set to
null and then I call a session.get(...) to obtain it. The embedded
attribute is not null as I was expecting.

The same this happend when I've tried it on ORM, is this the expected
behaviour?

Thanks,
Davide

[1]
https://github.com/hibernate/hibernate-ogm/blob/8a8b29f660973cad4c340931c4dcf9536342721b/core/src/test/java/org/hibernate/ogm/backendtck/embeddable/PhoneNumber.java

[2]
https://github.com/hibernate/hibernate-ogm/commit/bfed4e2df06f18960502af24fea72d45c1002fe7#diff-024806c2656dbe23ae1a5526f3a6845fR195


More information about the hibernate-dev mailing list