Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.29 KB | None | 0 0
  1. 014-10-31 13:14:13 DEBUG SQL:104 - update Book set Availability=?, Copies_Issued=?, Description=?, Image=?, In_Stock=?, Isbn=?, Published_Year=?, Publisher_Name=?, status=?, Title=?, Total_Stock=? where Book_Id=?
  2. 2014-10-31 13:14:13 TRACE BasicBinder:83 - binding parameter [1] as [VARCHAR] - AVAILABLE
  3. 2014-10-31 13:14:13 TRACE BasicBinder:83 - binding parameter [2] as [INTEGER] - 0
  4. 2014-10-31 13:14:13 TRACE BasicBinder:83 - binding parameter [3] as [VARCHAR] - Test description
  5. 2014-10-31 13:14:13 TRACE BasicBinder:83 - binding parameter [4] as [VARCHAR] - 1414741446090.jpg
  6. 2014-10-31 13:14:13 TRACE BasicBinder:83 - binding parameter [5] as [INTEGER] - 123
  7. 2014-10-31 13:14:13 TRACE BasicBinder:71 - binding parameter [6] as [VARCHAR] - <null>
  8. 2014-10-31 13:14:13 TRACE BasicBinder:83 - binding parameter [7] as [INTEGER] - 2014
  9. 2014-10-31 13:14:13 TRACE BasicBinder:83 - binding parameter [8] as [VARCHAR] - Test pub.
  10. 2014-10-31 13:14:13 TRACE BasicBinder:71 - binding parameter [9] as [VARCHAR] - <null>
  11. 2014-10-31 13:14:13 TRACE BasicBinder:83 - binding parameter [10] as [VARCHAR] - Test book 12
  12. 2014-10-31 13:14:13 TRACE BasicBinder:83 - binding parameter [11] as [INTEGER] - 123
  13. 2014-10-31 13:14:13 TRACE BasicBinder:83 - binding parameter [12] as [INTEGER] - 123
  14. 2014-10-31 13:14:13 DEBUG SQL:104 - delete from Book_Author where Book_Id=?
  15. 2014-10-31 13:14:13 TRACE BasicBinder:83 - binding parameter [1] as [INTEGER] - 123
  16. 2014-10-31 13:14:13 DEBUG SQL:104 - insert into Book_Author (Book_Id, Author_Id) values (?, ?)
  17. 2014-10-31 13:14:13 TRACE BasicBinder:83 - binding parameter [1] as [INTEGER] - 123
  18. 2014-10-31 13:14:13 TRACE BasicBinder:83 - binding parameter [2] as [INTEGER] - 147
  19. 2014-10-31 13:14:13 DEBUG SQL:104 - insert into Book_Author (Book_Id, Author_Id) values (?, ?)
  20. 2014-10-31 13:14:13 TRACE BasicBinder:83 - binding parameter [1] as [INTEGER] - 123
  21. 2014-10-31 13:14:13 TRACE BasicBinder:83 - binding parameter [2] as [INTEGER] - 147
  22. 2014-10-31 13:14:13 WARN SqlExceptionHelper:143 - SQL Error: 1062, SQLState: 23000
  23. 2014-10-31 13:14:13 ERROR SqlExceptionHelper:144 - Duplicate entry '123-147' for key 'PRIMARY'
  24. 2014-10-31 13:14:13 ERROR GenericDaoImpl:100 - Update operation FAILED org.hibernate.exception.ConstraintViolationException: Duplicate entry '123-147' for key 'PRIMARY'
  25. 2014-10-31 13:14:13 INFO HibernateFactory:133 - rolling back transaction
  26. 2014-10-31 13:14:13 INFO HibernateFactory:117 - closing session
  27. 2014-10-31 13:14:13 INFO AbstractBatchImpl:205 - HHH000010: On release of batch it still contained JDBC statements
  28.  
  29. package com.dao.dto;
  30.  
  31. import java.util.HashSet;
  32. import java.util.Set;
  33.  
  34. import javax.persistence.CascadeType;
  35. import javax.persistence.Column;
  36. import javax.persistence.Entity;
  37. import javax.persistence.FetchType;
  38. import javax.persistence.GeneratedValue;
  39. import javax.persistence.Id;
  40. import javax.persistence.JoinColumn;
  41. import javax.persistence.JoinTable;
  42. import javax.persistence.ManyToMany;
  43. import javax.persistence.OneToMany;
  44. import javax.persistence.Transient;
  45.  
  46. import org.codehaus.jackson.annotate.JsonManagedReference;
  47. import org.hibernate.annotations.Fetch;
  48. import org.hibernate.annotations.FetchMode;
  49. import org.springframework.web.multipart.MultipartFile;
  50.  
  51. // TODO: Auto-generated Javadoc
  52. /**
  53. * The Class Book.
  54. */
  55. @Entity
  56. public class Book implements java.io.Serializable {
  57.  
  58. /** The Constant serialVersionUID. */
  59. private static final long serialVersionUID = 1L;
  60.  
  61. /** The book id. */
  62. private int bookId;
  63.  
  64. /** The title. */
  65. private String title;
  66.  
  67. /** The isbn. */
  68. private String isbn;
  69.  
  70. /** The image. */
  71. private String image;
  72.  
  73. /** The in stock. */
  74. private int inStock;
  75.  
  76. /** The copies issued. */
  77. private int copiesIssued;
  78.  
  79. /** The published year. */
  80. private int publishedYear;
  81.  
  82. /** The publisher name. */
  83. private String publisherName;
  84.  
  85. /** The description. */
  86. private String description;
  87.  
  88. /** The availability. */
  89. private String availability;
  90.  
  91. /** The total stock. */
  92. private int totalStock;
  93.  
  94. /** The file. */
  95. private MultipartFile file;
  96.  
  97. private String status;
  98.  
  99. /** The authors. */
  100. private Set<Author> authors = new HashSet<Author>(0);
  101.  
  102. /** The categories. */
  103. private Set<Category> categories = new HashSet<Category>(0);
  104.  
  105. /** The languages. */
  106. private Set<Language> languages = new HashSet<Language>(0);
  107.  
  108. /** The users favorite. */
  109. private Set<User> usersFavorite = new HashSet<User>(0);
  110.  
  111. /** The return requests. */
  112. private Set<ReturnRequest> returnRequests = new HashSet<ReturnRequest>(0);
  113.  
  114. /** The delivery requests. */
  115. private Set<DeliveryRequest> deliveryRequests = new HashSet<DeliveryRequest>(
  116. 0);
  117.  
  118. /**
  119. * Gets the book id.
  120. *
  121. * @return the book id
  122. */
  123. @Id
  124. @GeneratedValue
  125. @Column(name = "Book_Id")
  126. public int getBookId() {
  127. return bookId;
  128. }
  129.  
  130. /**
  131. * Sets the book id.
  132. *
  133. * @param bookId
  134. * the new book id
  135. */
  136. public void setBookId(int bookId) {
  137. this.bookId = bookId;
  138. }
  139.  
  140. /**
  141. * Gets the title.
  142. *
  143. * @return the title
  144. */
  145. @Column(name = "Title")
  146. public String getTitle() {
  147. return title;
  148. }
  149.  
  150. /**
  151. * Sets the title.
  152. *
  153. * @param title
  154. * the new title
  155. */
  156. public void setTitle(String title) {
  157. this.title = title;
  158. }
  159.  
  160. /**
  161. * Gets the copies issued.
  162. *
  163. * @return the copies issued
  164. */
  165. @Column(name = "Copies_Issued")
  166. public int getCopiesIssued() {
  167. return copiesIssued;
  168. }
  169.  
  170. /**
  171. * Sets the copies issued.
  172. *
  173. * @param copiesIssued
  174. * the new copies issued
  175. */
  176. public void setCopiesIssued(int copiesIssued) {
  177. this.copiesIssued = copiesIssued;
  178. }
  179.  
  180.  
  181.  
  182. public String getStatus() {
  183. return status;
  184. }
  185.  
  186. public void setStatus(String status) {
  187. this.status = status;
  188. }
  189.  
  190. /**
  191. * Gets the isbn.
  192. *
  193. * @return the isbn
  194. */
  195. @Column(name = "Isbn")
  196. public String getIsbn() {
  197. return isbn;
  198. }
  199.  
  200. /**
  201. * Sets the isbn.
  202. *
  203. * @param isbn
  204. * the new isbn
  205. */
  206. public void setIsbn(String isbn) {
  207. this.isbn = isbn;
  208. }
  209.  
  210. /**
  211. * Gets the image.
  212. *
  213. * @return the image
  214. */
  215. @Column(name = "Image")
  216. public String getImage() {
  217. return image;
  218. }
  219.  
  220. /**
  221. * Sets the image.
  222. *
  223. * @param image
  224. * the new image
  225. */
  226. public void setImage(String image) {
  227. this.image = image;
  228. }
  229.  
  230. /**
  231. * Gets the in stock.
  232. *
  233. * @return the in stock
  234. */
  235. @Column(name = "In_Stock")
  236. public int getInStock() {
  237. return inStock;
  238. }
  239.  
  240. /**
  241. * Sets the in stock.
  242. *
  243. * @param inStock
  244. * the new in stock
  245. */
  246. public void setInStock(int inStock) {
  247. this.inStock = inStock;
  248. }
  249.  
  250. /**
  251. * Gets the total stock.
  252. *
  253. * @return the total stock
  254. */
  255. @Column(name = "Total_Stock")
  256. public int getTotalStock() {
  257. return totalStock;
  258. }
  259.  
  260. /**
  261. * Sets the total stock.
  262. *
  263. * @param totalStock
  264. * the new total stock
  265. */
  266. public void setTotalStock(int totalStock) {
  267. this.totalStock = totalStock;
  268. }
  269.  
  270. /**
  271. * Gets the published year.
  272. *
  273. * @return the published year
  274. */
  275. @Column(name = "Published_Year")
  276. public int getPublishedYear() {
  277. return publishedYear;
  278. }
  279.  
  280. /**
  281. * Sets the published year.
  282. *
  283. * @param publishedYear
  284. * the new published year
  285. */
  286. public void setPublishedYear(int publishedYear) {
  287. this.publishedYear = publishedYear;
  288. }
  289.  
  290. /**
  291. * Gets the publisher name.
  292. *
  293. * @return the publisher name
  294. */
  295. @Column(name = "Publisher_Name")
  296. public String getPublisherName() {
  297. return publisherName;
  298. }
  299.  
  300. /**
  301. * Sets the publisher name.
  302. *
  303. * @param publisherName
  304. * the new publisher name
  305. */
  306. public void setPublisherName(String publisherName) {
  307. this.publisherName = publisherName;
  308. }
  309.  
  310. /**
  311. * Gets the description.
  312. *
  313. * @return the description
  314. */
  315. @Column(name = "Description")
  316. public String getDescription() {
  317. return description;
  318. }
  319.  
  320. /**
  321. * Sets the description.
  322. *
  323. * @param description
  324. * the new description
  325. */
  326. public void setDescription(String description) {
  327. this.description = description;
  328. }
  329.  
  330. /**
  331. * Gets the availability.
  332. *
  333. * @return the availability
  334. */
  335. @Column(name = "Availability")
  336. public String getAvailability() {
  337. return availability;
  338. }
  339.  
  340. /**
  341. * Sets the availability.
  342. *
  343. * @param availability
  344. * the new availability
  345. */
  346. public void setAvailability(String availability) {
  347. this.availability = availability;
  348. }
  349.  
  350. /**
  351. * Gets the authors.
  352. *
  353. * @return the authors
  354. */
  355. @JsonManagedReference
  356. @ManyToMany(fetch = FetchType.EAGER)
  357. @JoinTable(name = "Book_Author", joinColumns = { @JoinColumn(name = "Book_Id", nullable = false) }, inverseJoinColumns = { @JoinColumn(name = "Author_Id", nullable = false) })
  358. public Set<Author> getAuthors() {
  359. return authors;
  360. }
  361.  
  362. /**
  363. * Sets the authors.
  364. *
  365. * @param authors
  366. * the new authors
  367. */
  368. public void setAuthors(Set<Author> authors) {
  369. this.authors = authors;
  370. }
  371.  
  372. /**
  373. * Gets the categories.
  374. *
  375. * @return the categories
  376. */
  377. @JsonManagedReference
  378. @ManyToMany(fetch = FetchType.EAGER)
  379. @JoinTable(name = "Book_Category", joinColumns = { @JoinColumn(name = "Book_Id", nullable = false) }, inverseJoinColumns = { @JoinColumn(name = "Category_Id", nullable = false) })
  380. public Set<Category> getCategories() {
  381. return categories;
  382. }
  383.  
  384. /**
  385. * Sets the categories.
  386. *
  387. * @param categories
  388. * the new categories
  389. */
  390. public void setCategories(Set<Category> categories) {
  391. this.categories = categories;
  392. }
  393.  
  394. /**
  395. * Gets the languages.
  396. *
  397. * @return the languages
  398. */
  399. @ManyToMany(fetch = FetchType.EAGER)
  400. @JoinTable(name = "Book_Language", joinColumns = { @JoinColumn(name = "Book_Id", nullable = false) }, inverseJoinColumns = { @JoinColumn(name = "Language_Id", nullable = false) })
  401. public Set<Language> getLanguages() {
  402. return languages;
  403. }
  404.  
  405. /**
  406. * Sets the languages.
  407. *
  408. * @param languages
  409. * the new languages
  410. */
  411. public void setLanguages(Set<Language> languages) {
  412. this.languages = languages;
  413. }
  414.  
  415. /**
  416. * Gets the users favorite.
  417. *
  418. * @return the users favorite
  419. */
  420. @ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
  421. @JoinTable(name = "User_Favorite", joinColumns = { @JoinColumn(name = "Book_Id", nullable = false) }, inverseJoinColumns = { @JoinColumn(name = "User_Id", nullable = false) })
  422. public Set<User> getUsersFavorite() {
  423. return usersFavorite;
  424. }
  425.  
  426. /**
  427. * Sets the users favorite.
  428. *
  429. * @param usersFavorite
  430. * the new users favorite
  431. */
  432. public void setUsersFavorite(Set<User> usersFavorite) {
  433. this.usersFavorite = usersFavorite;
  434. }
  435.  
  436. /**
  437. * Gets the file.
  438. *
  439. * @return the file
  440. */
  441. @Transient
  442. public MultipartFile getFile() {
  443. return file;
  444. }
  445.  
  446. /**
  447. * Sets the file.
  448. *
  449. * @param file
  450. * the new file
  451. */
  452. public void setFile(MultipartFile file) {
  453. this.file = file;
  454. }
  455.  
  456. /*
  457. * (non-Javadoc)
  458. *
  459. * @see java.lang.Object#toString()
  460. */
  461. @Override
  462. public String toString() {
  463. return getTitle();
  464. }
  465.  
  466. /**
  467. * Gets the return requests.
  468. *
  469. * @return the return requests
  470. */
  471. @OneToMany(fetch = FetchType.EAGER, mappedBy = "book")
  472. public Set<ReturnRequest> getReturnRequests() {
  473. return returnRequests;
  474. }
  475.  
  476. /**
  477. * Sets the return requests.
  478. *
  479. * @param returnRequests
  480. * the new return requests
  481. */
  482. public void setReturnRequests(Set<ReturnRequest> returnRequests) {
  483. this.returnRequests = returnRequests;
  484. }
  485.  
  486. /**
  487. * Gets the delivery requests.
  488. *
  489. * @return the delivery requests
  490. */
  491. @OneToMany(fetch = FetchType.EAGER, mappedBy = "book")
  492. public Set<DeliveryRequest> getDeliveryRequests() {
  493. return deliveryRequests;
  494. }
  495.  
  496. /**
  497. * Sets the delivery requests.
  498. *
  499. * @param deliveryRequests
  500. * the new delivery requests
  501. */
  502. public void setDeliveryRequests(Set<DeliveryRequest> deliveryRequests) {
  503. this.deliveryRequests = deliveryRequests;
  504. }
  505.  
  506. /*
  507. * (non-Javadoc)
  508. *
  509. * @see java.lang.Object#hashCode()
  510. */
  511. @Override
  512. public int hashCode() {
  513. final int prime = 31;
  514. int result = 1;
  515. result = prime * result + bookId;
  516. return result;
  517. }
  518.  
  519. /*
  520. * (non-Javadoc)
  521. *
  522. * @see java.lang.Object#equals(java.lang.Object)
  523. */
  524. @Override
  525. public boolean equals(Object obj) {
  526. if (this == obj) {
  527. return true;
  528. }
  529. if (obj == null) {
  530. return false;
  531. }
  532. if (getClass() != obj.getClass()) {
  533. return false;
  534. }
  535. Book other = (Book) obj;
  536. if (bookId != other.bookId) {
  537. return false;
  538. }
  539. return true;
  540. }
  541.  
  542. }
  543.  
  544. package com.dao.dto;
  545.  
  546. import java.io.Serializable;
  547. import java.util.HashSet;
  548. import java.util.Set;
  549.  
  550. import javax.persistence.Column;
  551. import javax.persistence.Entity;
  552. import javax.persistence.FetchType;
  553. import javax.persistence.GeneratedValue;
  554. import javax.persistence.Id;
  555. import javax.persistence.JoinColumn;
  556. import javax.persistence.JoinTable;
  557. import javax.persistence.ManyToMany;
  558. import javax.persistence.Table;
  559.  
  560. import org.codehaus.jackson.annotate.JsonBackReference;
  561. import org.hamcrest.Factory;
  562. import org.hibernate.annotations.Fetch;
  563. import org.hibernate.annotations.FetchMode;
  564.  
  565. // TODO: Auto-generated Javadoc
  566. /**
  567. * The Class Author.
  568. */
  569. @Entity
  570. @Table(name = "Author")
  571. public class Author implements Serializable {
  572.  
  573. /** The Constant serialVersionUID. */
  574. private static final long serialVersionUID = 1L;
  575.  
  576. /** The author id. */
  577. private int authorId;
  578.  
  579. /** The author name. */
  580. private String authorName;
  581.  
  582. /** The description. */
  583. private String description;
  584.  
  585. /** The books. */
  586. private Set<Book> books = new HashSet<Book>(0);
  587.  
  588. /**
  589. * Gets the author id.
  590. *
  591. * @return the author id
  592. */
  593. @Id
  594. @GeneratedValue
  595. @Column(name = "Author_Id")
  596. public int getAuthorId() {
  597. return authorId;
  598. }
  599.  
  600. /**
  601. * Sets the author id.
  602. *
  603. * @param authorId
  604. * the new author id
  605. */
  606. public void setAuthorId(int authorId) {
  607. this.authorId = authorId;
  608. }
  609.  
  610. /**
  611. * Gets the author name.
  612. *
  613. * @return the author name
  614. */
  615. @Column(name = "Author_Name", nullable = false)
  616. public String getAuthorName() {
  617. return authorName;
  618. }
  619.  
  620. /**
  621. * Sets the author name.
  622. *
  623. * @param authorName
  624. * the new author name
  625. */
  626. public void setAuthorName(String authorName) {
  627. this.authorName = authorName;
  628. }
  629.  
  630. /**
  631. * Gets the description.
  632. *
  633. * @return the description
  634. */
  635. @Column(name = "Description")
  636. public String getDescription() {
  637. return description;
  638. }
  639.  
  640. /**
  641. * Sets the description.
  642. *
  643. * @param description
  644. * the new description
  645. */
  646. public void setDescription(String description) {
  647. this.description = description;
  648. }
  649.  
  650. /*
  651. * (non-Javadoc)
  652. *
  653. * @see java.lang.Object#toString()
  654. */
  655. public String toString() {
  656. return getAuthorName();
  657. }
  658.  
  659. /**
  660. * Gets the books.
  661. *
  662. * @return the books
  663. */
  664. @JsonBackReference
  665. @ManyToMany(mappedBy ="authors" ,fetch = FetchType.LAZY)
  666. public Set<Book> getBooks() {
  667. return books;
  668. }
  669.  
  670. /**
  671. * Sets the books.
  672. *
  673. * @param books
  674. * the new books
  675. */
  676. public void setBooks(Set<Book> books) {
  677. this.books = books;
  678. }
  679.  
  680. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement