Column Annotation absolutly necessary in JPA?

java, jpa

Solution

No. it's not "necessary", unless you want to override default column naming, or default datastore column type etc. And just putting @Column does nothing as such anyway

Problem

I have an another question concerning JPA. Is it necessary to annotate each member variable with @Column, if i want to store it in my database? Or is it possible to leave it out by some member variables (in these example the field "timestamp") and this field will be stored in database in each possible scenario: ``` @Entity @Table(name = "usercontent") public class UserContentEntity implements Persistable<Long> { /** serialVersionUID */ private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @Column(name = "description") private String contentdescription; @Column(name = "name") private String contentname; @Column(name = "bytes") @Lob private byte[] contentbytes; @Column private String creator; private Date timestamp; // get- and set methods } ``` And when it is absolutley necessary to use the annotation @Column? Thanks a lot Maik

Original source