-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
7 changed files
with
20 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,20 +17,16 @@ | |
|
||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.data.jpa.repository.config.EnableJpaAuditing; | ||
import org.springframework.data.mongodb.config.EnableMongoAuditing; | ||
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; | ||
|
||
/** | ||
* A BaseConfiguration enables auto configuration of Spring Data JPA and MongoDB Auditing and instantiates a JSR-303 ValidatorFactory. | ||
* A BaseConfiguration enables instantiates a JSR-303 ValidatorFactory. | ||
* | ||
* @author <a href="mailto:[email protected]">Heiko Scherrer</a> | ||
* @version 1.1 | ||
* @since 1.0 | ||
*/ | ||
@Configuration | ||
@EnableJpaAuditing | ||
@EnableMongoAuditing | ||
public class BaseConfiguration { | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
*/ | ||
package org.ameba.integration.mongodb; | ||
|
||
import java.time.ZonedDateTime; | ||
import java.util.Date; | ||
|
||
import org.ameba.integration.TypedEntity; | ||
import org.springframework.data.annotation.CreatedDate; | ||
|
@@ -26,7 +26,9 @@ | |
import org.springframework.data.mongodb.core.mapping.Field; | ||
|
||
/** | ||
* A BaseEntity is a base superclass for MongoDB document entities. | ||
* A BaseEntity is a base superclass for MongoDB document entities that defined useful fields for optimistic locking, unique persisted key, | ||
* and timestamps for last change or insertion date. To active the latter feature the Spring application context need to enable Spring Data | ||
* MongoDB MongoAuditingRegistrar. One approach to do this is to add {@code @EnableMongoAuditing} on a Spring configuration class. | ||
* | ||
* @author <a href="mailto:[email protected]">Heiko Scherrer</a> | ||
* @version 1.0 | ||
|
@@ -52,14 +54,14 @@ public class BaseEntity implements TypedEntity<String> { | |
/** Timestamp when the document was inserted. */ | ||
@Field(FIELD_CREATED) | ||
@CreatedDate | ||
private ZonedDateTime createDt; | ||
private Date createDt; | ||
/** Field name of the timestamp when the document was inserted. */ | ||
public static final String FIELD_CREATED = "_created"; | ||
|
||
/** Timestamp when the document was updated the last time. */ | ||
@Field(FIELD_UPDATED) | ||
@LastModifiedDate | ||
private ZonedDateTime lastModifiedDt; | ||
private Date lastModifiedDt; | ||
/** Field name of the timestamp when the document was updated the last time. */ | ||
public static final String FIELD_UPDATED = "_updated"; | ||
|
||
|
@@ -95,7 +97,7 @@ void setPk(String pk) { | |
* | ||
* @return Creation date | ||
*/ | ||
public ZonedDateTime getCreateDt() { | ||
public Date getCreateDt() { | ||
return createDt; | ||
} | ||
|
||
|
@@ -104,7 +106,7 @@ public ZonedDateTime getCreateDt() { | |
* | ||
* @return Last modified date | ||
*/ | ||
public ZonedDateTime getLastModifiedDt() { | ||
public Date getLastModifiedDt() { | ||
return lastModifiedDt; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters