br.com.utfpr.porta.modelo.AnuncioUsuario Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tcc-porta-servico Show documentation
Show all versions of tcc-porta-servico Show documentation
Projeto serviço que realiza acesso ao banco de dados para o projeto API e web
The newest version!
package br.com.utfpr.porta.modelo;
import java.io.Serializable;
import java.time.LocalDateTime;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
import javax.persistence.Table;
@Entity
@Table(name = "anuncio_usuario")
public class AnuncioUsuario implements Serializable {
private static final long serialVersionUID = 1L;
@EmbeddedId
private AnuncioUsuarioId id;
@Column(name = "data_hora_criacao", updatable=false)
private LocalDateTime dataHoraCriacao;
@Column(name = "data_hora_alteracao")
private LocalDateTime dataHoraAlteracao;
@PrePersist
private void prePersist() {
this.dataHoraCriacao = LocalDateTime.now();
this.dataHoraAlteracao = LocalDateTime.now();
}
@PreUpdate
private void preUpdate() {
this.dataHoraAlteracao = LocalDateTime.now();
}
public AnuncioUsuario() {}
public AnuncioUsuario(AnuncioUsuarioId id) {
super();
this.id = id;
}
public AnuncioUsuarioId getId() {
return id;
}
public void setId(AnuncioUsuarioId id) {
this.id = id;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
AnuncioUsuario other = (AnuncioUsuario) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy