-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from yelken/feature/classe-iguana
add class Iguana
- Loading branch information
Showing
1 changed file
with
78 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package com.example.crud.model; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import org.springframework.data.annotation.CreatedDate; | ||
import org.springframework.data.annotation.LastModifiedDate; | ||
import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
|
||
import javax.persistence.*; | ||
import javax.validation.constraints.NotBlank; | ||
import java.util.Date; | ||
|
||
@Entity | ||
@Table(name = "iguanas") | ||
@EntityListeners(AuditingEntityListener.class) | ||
@JsonIgnoreProperties(value = {"createdAt", "updatedAt"}, | ||
allowGetters = true) | ||
public class Iguana { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@NotBlank | ||
private String title; | ||
|
||
@NotBlank | ||
private String content; | ||
|
||
@Column(nullable = false, updatable = false) | ||
@Temporal(TemporalType.TIMESTAMP) | ||
@CreatedDate | ||
private Date createdAt; | ||
|
||
@Column(nullable = false) | ||
@Temporal(TemporalType.TIMESTAMP) | ||
@LastModifiedDate | ||
private Date updatedAt; | ||
|
||
public Long getId() { | ||
return id; | ||
} | ||
|
||
public void setId(Long id) { | ||
this.id = id; | ||
} | ||
|
||
public String getTitle() { | ||
return title; | ||
} | ||
|
||
public void setTitle(String title) { | ||
this.title = title; | ||
} | ||
|
||
public String getContent() { | ||
return content; | ||
} | ||
|
||
public void setContent(String content) { | ||
this.content = content; | ||
} | ||
|
||
public Date getCreatedAt() { | ||
return createdAt; | ||
} | ||
|
||
public void setCreatedAt(Date createdAt) { | ||
this.createdAt = createdAt; | ||
} | ||
|
||
public Date getUpdatedAt() { | ||
return updatedAt; | ||
} | ||
|
||
public void setUpdatedAt(Date updatedAt) { | ||
this.updatedAt = updatedAt; | ||
} | ||
|
||
} |