Advertisement
Guest User

Untitled

a guest
Jan 21st, 2020
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. Krok 1
  2.  
  3. Pracujemy na tabeli:
  4. create table USERR(
  5. User_ID INT NOT NULL,
  6. Username Varchar(20) not null,
  7. Created_by Varchar(20) not null,
  8. Created_date date not null,
  9. Primary key(User_ID))
  10.  
  11. Krok 2
  12.  
  13. W wierszu poleceń wykonaj (tworzymy project HibernateSampleExample):
  14. mvn archetype:generate -DgroupId=com.javawebtutor -DartifactId=HibernateSampleExample -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
  15.  
  16. Krok 3
  17.  
  18. W wierszu poleceń wykonaj (konwertujemy project do eclipse) (Przejdź do katalogu HibernateSampleExample)
  19. mvn eclipse:eclipse
  20.  
  21. Krok 4
  22.  
  23. W eclipse
  24. File –> Import –> General -> Existing Projects into Workspace –>lokalizacja_projektu
  25.  
  26. Krok 5
  27.  
  28. Utwórz folder (o ile nie istnieją)
  29. /src/main/resources oraz /src/main
  30.  
  31. Krok 6
  32.  
  33. zmodyfikuj pom.xml
  34.  
  35. Krok 7
  36.  
  37. W wierszu poleceń wykonaj (maven pobierze potrzebne pliki)
  38. mvn eclipse:eclipse
  39.  
  40. Krok 8
  41.  
  42. Utwórz hibernate.cfg.xml w "/src/main/resources". Zmodyfikuj hibernate.cfg.xml
  43.  
  44. Krok 9
  45.  
  46. Utwórz klasę (java class) "Userr" w com.javawebtutor. zmodyfikuj Userr.java
  47.  
  48. krok 10
  49.  
  50. Utwórz "Userr.hbm.xml" mapping file w folderze "src/main/resources". Zmodyfikuj userr.hbm.xml
  51.  
  52. Krok 11
  53.  
  54. Utwórz klasę HibernateUtil.java. Zmodyfikuj HibernateUtil.java
  55.  
  56. Krok 12
  57.  
  58. BuildPath ->Apply and close
  59.  
  60. Krok 13
  61.  
  62. Utwórz klasę Test.java (przetestuj działane programu).
  63.  
  64. Krok 14
  65.  
  66. Sprawdź bazę danych.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement