Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ehabqadah
Last active July 18, 2020 10:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ehabqadah/fa1eef840fa6f4949ffa1b8e75d6b43a to your computer and use it in GitHub Desktop.
Save ehabqadah/fa1eef840fa6f4949ffa1b8e75d6b43a to your computer and use it in GitHub Desktop.
/**
* <p> Root entity for object persistence via JPA.</p>
*
* @author Ehab Qadah
*/
@MappedSuperclass
public abstract class BaseEntity {
@Id
@GeneratedValue(generator = "custom-generator",
strategy = GenerationType.IDENTITY)
@GenericGenerator(
name = "custom-generator",
strategy = "com.qadah.demo.data.model.id.generator.BaseIdentifierGenerator")
protected String id;
@CreationTimestamp
@Column(name = "created_at", updatable = false, nullable = false)
protected Instant createdAt;
@UpdateTimestamp
@Column(name = "modified_at")
protected Instant modifiedAt;
@Column
@Version
protected int version;
// standard setters and getters
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment