I was looking for a way to automatically set create date on insert and modified date on update via JPA. The @PrePersist and @PreUpdate work like a charm:

   /**
     * Auto set create/modify date on insert
     */
    @PrePersist
    private void onInsert()
    {
        setCreateDate(new Date());
        setModifyDate(new Date());
    }

    /**
     * Auto set modify date on update
     */
    @PreUpdate
    private void onUpdate()
    {
        setModifyDate(new Date());
    }

Hibernate

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-2) was last changed on 25-Mar-2008 21:49 by donohoe [RSS]