daily pastebin goal
67%
SHARE
TWEET

Untitled

a guest Jun 29th, 2018 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @Entity
  2. @Table(name="suggestion")
  3. @JsonIgnoreProperties({"suggestionLikes"})
  4. public class Suggestion {
  5.  
  6. public Suggestion() {
  7.     // TODO Auto-generated constructor stub
  8. }
  9.  
  10. @Id
  11. @GeneratedValue(strategy=GenerationType.IDENTITY)
  12. @Column(name="suggestion_id")
  13. private Integer suggestionId;
  14.  
  15. @Column(name="description")
  16. private String description;
  17.  
  18. @ManyToOne(fetch = FetchType.LAZY)
  19. @JoinColumn(name="suggestion_by")
  20. private UserProfile user;
  21.  
  22. //getters and setters
  23. }
  24.    
  25. @Entity
  26. @Table(name = "user_master")
  27. @JsonIgnoreProperties({"suggestions", "suggestionLikes"})
  28. public class UserProfile implements Serializable {
  29.  
  30. /**
  31.  *
  32.  */
  33. private static final long serialVersionUID = 7400472171878370L;
  34.  
  35.  
  36. public UserProfile() {
  37.  
  38. }
  39.  
  40.  
  41. @Id
  42. @NotNull
  43. @Column(name = "username", length = 55)
  44. private String userName;
  45.  
  46. @NotNull
  47. @Column(name = "password")
  48. private String password;
  49.  
  50. @OneToMany(mappedBy = "user", fetch = FetchType.LAZY)
  51. private Set<Suggestion> suggestions;
  52.  
  53. //getters and setters
  54. }
  55.    
  56. @Override
  57. @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
  58. public List<Suggestion> getAllSuggestion() {
  59.     ArrayList<Suggestion> suggestions = (ArrayList<Suggestion>)
  60.     suggestionRespository.findAll();
  61.  
  62.     return suggestions;
  63. }
  64.    
  65. @Repository
  66. public interface SuggestionRespository extends JpaRepository<Suggestion,
  67. Integer> {
  68.  
  69.     public List<Suggestion> findAll();
  70. }
  71.    
  72. @EnableTransactionManagement
  73. @SpringBootApplication
  74. public class AngularSpringbootApplication {
  75.  
  76. public static void main(String[] args) {
  77.     SpringApplication.run(AngularSpringbootApplication.class, args);
  78. }
  79. }
  80.    
  81. spring.datasource.url=jdbc:mysql://localhost:3306/plan_trip
  82. spring.datasource.username=root
  83. spring.datasource.password=root
  84.  
  85. spring.jpa.properties.hibernate.dialect =
  86. org.hibernate.dialect.MySQL5InnoDBDialect
  87. spring.jpa.hibernate.ddl-auto = update
  88. spring.jackson.serialization.fail-on-empty-beans=false
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