SHARE
TWEET

Untitled

a guest Oct 2nd, 2017 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @Entity
  2. public class User {
  3.  
  4.     // form:hidden - hidden value
  5.     @Id
  6.     @GeneratedValue(strategy = GenerationType.IDENTITY)
  7.     Integer id;
  8.  
  9.     // form:input - textbox
  10.     @Column(name = "name", columnDefinition = "VARCHAR(30)", nullable = false)
  11.     String name;
  12.  
  13.     // form:input - textbox
  14.     @Column(name = "email", columnDefinition = "VARCHAR(50)", nullable = false)
  15.     String email;
  16.  
  17.     // form:textarea - textarea
  18.     @Column(name = "address", columnDefinition = "VARCHAR(255)", nullable = true)
  19.     String address;
  20.  
  21.     // form:input - password
  22.     @Column(name = "password", columnDefinition = "VARCHAR(20)", nullable = false)
  23.     String password;
  24.  
  25.     // form:input - password
  26.     String confirmPassword;
  27.  
  28.     // form:checkbox - single checkbox
  29.     @Column(name = "newsletter", nullable = true)
  30.     boolean newsletter;
  31.  
  32.     // form:checkboxes - multiple checkboxes
  33. //    @Column(columnDefinition = "VARCHAR(500)", nullable = false)
  34.     @ElementCollection
  35.     List<String> framework;
  36.  
  37.     // form:radiobutton - radio button
  38.     @Column(name = "sex", columnDefinition = "VARCHAR(1)", nullable = true)
  39.     String sex;
  40.  
  41.     // form:radiobuttons - radio button
  42.     @Column(name = "number", nullable = true)
  43.     Integer number;
  44.  
  45.     // form:select - form:option - dropdown - single select
  46.     @Column(name = "", columnDefinition = "VARCHAR(10)", nullable = true)
  47.     String country;
  48.  
  49.     // form:select - multiple=true - dropdown - multiple select
  50. //    @Column(columnDefinition = "VARCHAR(500)", nullable = true)
  51.     @ElementCollection
  52.     List<String> skill;
  53.  
  54.     //Check if this is for New of Update
  55.     public boolean isNew() {
  56.         return (this.id == null);
  57.     }
  58.  
  59.  
  60.     public Integer getId() {
  61.         return id;
  62.     }
  63.  
  64.     public void setId(Integer id) {
  65.         this.id = id;
  66.     }
  67.  
  68.     public String getName() {
  69.         return name;
  70.     }
  71.  
  72.     public void setName(String name) {
  73.         this.name = name;
  74.     }
  75.  
  76.     public String getEmail() {
  77.         return email;
  78.     }
  79.  
  80.     public void setEmail(String email) {
  81.         this.email = email;
  82.     }
  83.  
  84.     public String getAddress() {
  85.         return address;
  86.     }
  87.  
  88.     public void setAddress(String address) {
  89.         this.address = address;
  90.     }
  91.  
  92.     public String getPassword() {
  93.         return password;
  94.     }
  95.  
  96.     public void setPassword(String password) {
  97.         this.password = password;
  98.     }
  99.  
  100.     public String getConfirmPassword() {
  101.         return confirmPassword;
  102.     }
  103.  
  104.     public void setConfirmPassword(String confirmPassword) {
  105.         this.confirmPassword = confirmPassword;
  106.     }
  107.  
  108.     public boolean isNewsletter() {
  109.         return newsletter;
  110.     }
  111.  
  112.     public void setNewsletter(boolean newsletter) {
  113.         this.newsletter = newsletter;
  114.     }
  115.  
  116.     public List<String> getFramework() {
  117.         return framework;
  118.     }
  119.  
  120.     public void setFramework(List<String> framework) {
  121.         this.framework = framework;
  122.     }
  123.  
  124.     public String getSex() {
  125.         return sex;
  126.     }
  127.  
  128.     public void setSex(String sex) {
  129.         this.sex = sex;
  130.     }
  131.  
  132.     public Integer getNumber() {
  133.         return number;
  134.     }
  135.  
  136.     public void setNumber(Integer number) {
  137.         this.number = number;
  138.     }
  139.  
  140.     public String getCountry() {
  141.         return country;
  142.     }
  143.  
  144.     public void setCountry(String country) {
  145.         this.country = country;
  146.     }
  147.  
  148.     public List<String> getSkill() {
  149.         return skill;
  150.     }
  151.  
  152.     public void setSkill(List<String> skill) {
  153.         this.skill = skill;
  154.     }
  155.  
  156.     @Override
  157.     public boolean equals(Object o) {
  158.         if (this == o) return true;
  159.         if (!(o instanceof User)) return false;
  160.  
  161.         User user = (User) o;
  162.  
  163.         if (isNewsletter() != user.isNewsletter()) return false;
  164.         if (!getId().equals(user.getId())) return false;
  165.         if (!getName().equals(user.getName())) return false;
  166.         if (!getEmail().equals(user.getEmail())) return false;
  167.         if (getAddress() != null ? !getAddress().equals(user.getAddress()) : user.getAddress() != null) return false;
  168.         if (!getPassword().equals(user.getPassword())) return false;
  169.         if (getConfirmPassword() != null ? !getConfirmPassword().equals(user.getConfirmPassword()) : user.getConfirmPassword() != null)
  170.             return false;
  171.         if (!getFramework().equals(user.getFramework())) return false;
  172.         if (getSex() != null ? !getSex().equals(user.getSex()) : user.getSex() != null) return false;
  173.         if (getNumber() != null ? !getNumber().equals(user.getNumber()) : user.getNumber() != null) return false;
  174.         if (getCountry() != null ? !getCountry().equals(user.getCountry()) : user.getCountry() != null) return false;
  175.         return getSkill() != null ? getSkill().equals(user.getSkill()) : user.getSkill() == null;
  176.     }
  177.  
  178.     @Override
  179.     public int hashCode() {
  180.  
  181.         int result = getId().hashCode();
  182.  
  183.         result = 31 * result + getName().hashCode();
  184.         result = 31 * result + getEmail().hashCode();
  185.         result = 31 * result + (getAddress() != null ? getAddress().hashCode() : 0);
  186.         result = 31 * result + getPassword().hashCode();
  187.         result = 31 * result + (getConfirmPassword() != null ? getConfirmPassword().hashCode() : 0);
  188.         result = 31 * result + (isNewsletter() ? 1 : 0);
  189.         result = 31 * result + getFramework().hashCode();
  190.         result = 31 * result + (getSex() != null ? getSex().hashCode() : 0);
  191.         result = 31 * result + (getNumber() != null ? getNumber().hashCode() : 0);
  192.         result = 31 * result + (getCountry() != null ? getCountry().hashCode() : 0);
  193.         result = 31 * result + (getSkill() != null ? getSkill().hashCode() : 0);
  194.         return result;
  195.     }
  196. }
  197.    
  198. public interface CrudRepository<T, ID extends Serializable>
  199.         extends Repository<T, ID> {
  200.  
  201.     <S extends T> S save(S entity);
  202.  
  203.     T findOne(ID primaryKey);
  204.  
  205.     Iterable<T> findAll();
  206.  
  207.     Long count();
  208.  
  209.     void delete(T entity);
  210.  
  211.     boolean exists(ID primaryKey);
  212.  
  213.     // … more functionality omitted.
  214. }
  215.    
  216. @Repository
  217. public interface IUserRepository extends CrudRepository<User, Long>{
  218.  
  219. }
  220.    
  221. Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'crudRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Not a managed type: class java.lang.Object
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top