All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.t3t5u.common.database.AbstractEntity Maven / Gradle / Ivy

The newest version!
package com.github.t3t5u.common.database;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

import org.apache.commons.lang3.builder.ToStringBuilder;

@SuppressWarnings("serial")
public abstract class AbstractEntity implements Entity {
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = COLUMN_NAME_ID)
	private long id = UNDEFINED_ID;
	@Column(name = COLUMN_NAME_CREATED_AT, nullable = false)
	private Date createdAt;
	@Column(name = COLUMN_NAME_UPDATED_AT)
	private Date updatedAt;

	@Override
	public long getId() {
		return id;
	}

	@Override
	public void setId(final long id) {
		this.id = id;
	}

	@Override
	public Date getCreatedAt() {
		return createdAt;
	}

	@Override
	public void setCreatedAt(final Date createdAt) {
		this.createdAt = createdAt;
	}

	@Override
	public Date getUpdatedAt() {
		return updatedAt;
	}

	@Override
	public void setUpdatedAt(final Date updatedAt) {
		this.updatedAt = updatedAt;
	}

	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy