* Define beans for handling different message types in a lean chat app * Add class based spring beans configuration * Define spring configuration in XML for constructor based bean injection * Refactor package structure to separate constructor based bean injection code set from setter based bean injection code set * Define configuration and classes specific to setter-based bean injection. * Implement tests for constructor-based and setter-based bean injections * develop codes for explaining type erasure * Write unit tests for type erasure examples * Remove evaluation article code * Modify type erasure examples and unit tests * Modify type erasure examples and unit tests * Add expected exception in TypeErasureUnitTest * Correct grammar in class name * Implement File Manager app to demonstrate Polymorphism. Develop unit tests for Polymorphism article code * Add examples for static polymorphism * Change sysout statments to slf4j log info statements * Add assertions and expected errors check on Test * Add assertions and expected errors check on Test * Correct compile time error of symbol not found * Removed commented out non-compiling test. * Replace string concatenations with String.format * Replace string concatenations with String.format * Remove verbose file info descriptor and replace with simpler one * Add example codes for Hibernate Interceptors article Write tests for session-scoped and sessionFactory-scoped interceptors * Implement serializable on customInterceptorImpl * Implement examples for spring data with spring security integration * Remove webapp example implementations; too extensive
64 lines
1.2 KiB
Java
64 lines
1.2 KiB
Java
package com.baeldung.models;
|
|
|
|
import java.util.HashSet;
|
|
import java.util.Set;
|
|
|
|
import javax.persistence.ElementCollection;
|
|
import javax.persistence.Entity;
|
|
import javax.persistence.FetchType;
|
|
import javax.persistence.GeneratedValue;
|
|
import javax.persistence.GenerationType;
|
|
import javax.persistence.Id;
|
|
|
|
@Entity
|
|
public class Tweet {
|
|
@Id
|
|
@GeneratedValue(strategy = GenerationType.SEQUENCE)
|
|
private long id;
|
|
private String tweet;
|
|
private String owner;
|
|
@ElementCollection(targetClass = String.class, fetch = FetchType.EAGER)
|
|
private Set<String> likes = new HashSet();
|
|
|
|
public long getId() {
|
|
return id;
|
|
}
|
|
|
|
public void setId(long id) {
|
|
this.id = id;
|
|
}
|
|
|
|
private Tweet() {
|
|
}
|
|
|
|
public Tweet(String tweet, String owner) {
|
|
this.tweet = tweet;
|
|
this.owner = owner;
|
|
}
|
|
|
|
public String getTweet() {
|
|
return tweet;
|
|
}
|
|
|
|
public void setTweet(String tweet) {
|
|
this.tweet = tweet;
|
|
}
|
|
|
|
public String getOwner() {
|
|
return owner;
|
|
}
|
|
|
|
public void setOwner(String owner) {
|
|
this.owner = owner;
|
|
}
|
|
|
|
public Set<String> getLikes() {
|
|
return likes;
|
|
}
|
|
|
|
public void setLikes(Set<String> likes) {
|
|
this.likes = likes;
|
|
}
|
|
|
|
}
|