im wondering because my embedded data are stored as "Mongo Binary Data".
@MappedSuperclass
@NoSql(dataFormat=DataFormatType.MAPPED)
public abstract class AbstractEntity implements EntityInterface -> this interface implements Serializable
{
private static final long serialVersionUID = -1896393585386203770L;
@Id
@GeneratedValue
@Field(name="_id")
private String id;
@Version
private Integer version;
...
}
This class (entity) will be stored in the collection. And via rockmongo or mongo shell ist readable.
@Entity
@NoSql(dataFormat=DataFormatType.MAPPED)
public class Entity_A extends AbstractEntity{
private static final long serialVersionUID = -1896693585386203723L;
@Basic private String name;
....
@ElementCollection private List<Entity_B> myList;
...
}
This class is only a container for the concrete Entity_C classes.
Entity_B should not be stored, only the inherited Entity_C entities.
@MappedSuperclass
@NoSql(dataFormat=DataFormatType.MAPPED)
public abstract class Entity_B extends AbstractEntity {
@Basic private String text;
@ManyToOne(fetch = FetchType.LAZY)
private Entity_A entity_a;
...
}
This is the entity which should to be embedded to Entity_A.
@Embeddable
@NoSql(dataFormat=DataFormatType.MAPPED)
public class Entity_C extends Entity_B {
private static final long serialVersionUID = -1296535885386223208L;
@Basic private String field1;
...
...
@Basic private String fieldN;
}
In mongoDb Collection: i have the Entity_A collection which holds Entity_A and there a field myList which holds the embedded ones - BUT as "Mongo Binary Data", why not as readable list as in many other guides?
Hops you can help!