I have one more question regarding JPA. Do I need to annotate each @Column member variable if I want to store it in my database? Or you can leave it with some member variables (in this example, the "timestamp" field), and this field will be stored in the database in every 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 do you absolutely need to use the @Column annotation?
Thanks a lot Maik
java jpa
Maikhansen
source share