Quantcast
Channel: Spring Community Forums - Data
Viewing all articles
Browse latest Browse all 297

Spring data jpa and problem with @LastModifiedDate annotation

$
0
0
Hi,
i created a very small test application to get involved in the spring data package. I create a very small app with Spring,JPA and hibernate. I used the spring JpaRepository for the database operations and it worked very well. Now i just played around with the annotation in the data package. The @version annotation worked very well, but the @LastModifiedDate or @CreatedDate does not work.

Here are my database Entities:
Code:

@MappedSuperclass
public class BaseEntity implements Serializable {
        /**
        *
        */
        private static final long serialVersionUID = 1L;

        @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    protected Integer id;

        @Version
        private Integer version;
       
        @LastModifiedDate
        private DateTime lastModifiedDate;
       
        @CreatedDate
        private DateTime createdDate;
/* getters and setter
all Date values are joda DateTime
/*

Code:

@Entity
public class FirstEntity extends BaseEntity {
       
        private static final long serialVersionUID = 1L;
       
        @Column
        @NotEmpty
        String name;
/* getters and setter */

After persisting the object, the DateTime values are null. Is there somting special i have to configure to get it running?

I am very new in this business, so please let me know if you need more informations about it.

Viewing all articles
Browse latest Browse all 297

Trending Articles