Is this object to table mapping possible?

I abandoned using an hbm file and added Annotations to the class. I added the annotation @ ElementCollection to the List and got it to refer to the same table as the class (is this recommended???) :

@Table(name="myobj_ser")
public class MyObj  {
@Id
@Column(name="id", nullable=false)
private String id;

@ElementCollection
@CollectionTable(name="myobj_ser")
private List<byte[]> serData = new ArrayList<>();

This resulted in a table with 3 columns:

  • id
  • MyObj_id
  • serData

Can you advise as to how I can annotate to get the correct columns?