Created
May 29, 2016 21:29
-
-
Save PreSoichiSumi/032ad5bb1e44a6f76ec7c25434f99c0f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
package models; | |
import com.avaje.ebean.Model; | |
import com.avaje.ebean.annotation.CreatedTimestamp; | |
import com.avaje.ebean.annotation.Index; | |
import play.data.validation.Constraints; | |
import javax.persistence.*; | |
import java.util.Date; | |
/** | |
* Created by s-sumi on 2016/05/08. | |
*/ | |
@Entity | |
public class Tweet extends Model { | |
@EmbeddedId | |
@AttributeOverrides({ | |
@AttributeOverride(name = "tweetId", column = @Column(name="tweet_id",nullable = false)), | |
@AttributeOverride(name = "postDate", column = @Column(name = "post_date",nullable = false))}) | |
public CombinedTweetKey tweetKey; | |
@Constraints.Required | |
@Constraints.Pattern(value = "\\w{1,140}", message = "ツイートは英数字で1-140字です") | |
public String content; | |
@ManyToOne | |
public User user; | |
public CombinedTweetKey getTweetKey() { | |
return tweetKey; | |
} | |
public void setTweetKey(CombinedTweetKey tweetKey) { | |
this.tweetKey = tweetKey; | |
} | |
public String getContent() { | |
return content; | |
} | |
public void setContent(String content) { | |
this.content = content; | |
} | |
public User getUser() { | |
return user; | |
} | |
public void setUser(User user) { | |
this.user = user; | |
} | |
public static Finder<Long, Tweet> find = new Finder<>(Tweet.class); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment