[{"data":1,"prerenderedAt":1927},["ShallowReactive",2],{"navigation":3,"\u002Fblog\u002F2012-02-02-fast-track-to-hibernate":406,"\u002Fblog\u002F2012-02-02-fast-track-to-hibernate-surround":1916},[4,8,39,52,264,310,319,380,397],{"title":5,"path":6,"stem":7},"Notes","\u002Fnotes","1.notes\u002Findex",{"title":9,"path":10,"stem":11,"children":12,"page":30},"Architecture","\u002Fnotes\u002Farchitecture","1.notes\u002Farchitecture",[13,17,31,35],{"title":14,"path":15,"stem":16},"API Management","\u002Fnotes\u002Farchitecture\u002Fapi-management","1.notes\u002Farchitecture\u002Fapi-management",{"title":18,"path":19,"stem":20,"children":21,"page":30},"Data","\u002Fnotes\u002Farchitecture\u002Fdata","1.notes\u002Farchitecture\u002Fdata",[22,26],{"title":23,"path":24,"stem":25},"ERD","\u002Fnotes\u002Farchitecture\u002Fdata\u002Ferd","1.notes\u002Farchitecture\u002Fdata\u002Ferd",{"title":27,"path":28,"stem":29},"SCWD","\u002Fnotes\u002Farchitecture\u002Fdata\u002Fscwd","1.notes\u002Farchitecture\u002Fdata\u002Fscwd",false,{"title":32,"path":33,"stem":34},"Microservices","\u002Fnotes\u002Farchitecture\u002Fmicroservices","1.notes\u002Farchitecture\u002Fmicroservices",{"title":36,"path":37,"stem":38},"OAuth","\u002Fnotes\u002Farchitecture\u002Foauth","1.notes\u002Farchitecture\u002Foauth",{"title":40,"path":41,"stem":42,"children":43,"page":30},"Archive","\u002Fnotes\u002Farchive","1.notes\u002Farchive",[44,48],{"title":45,"path":46,"stem":47},"Google Web Toolkit","\u002Fnotes\u002Farchive\u002Fgwt","1.notes\u002Farchive\u002Fgwt",{"title":49,"path":50,"stem":51},"Jekyll","\u002Fnotes\u002Farchive\u002Fjekyll","1.notes\u002Farchive\u002Fjekyll",{"title":53,"path":54,"stem":55,"children":56,"page":30},"Development","\u002Fnotes\u002Fdevelopment","1.notes\u002Fdevelopment",[57,74,112,149,226,239,260],{"title":58,"icon":30,"path":59,"stem":60,"children":61,"page":30},"IDE","\u002Fnotes\u002Fdevelopment\u002Fide","1.notes\u002Fdevelopment\u002FIDE",[62,66,70],{"title":63,"path":64,"stem":65},"Jetbrains IDE","\u002Fnotes\u002Fdevelopment\u002Fide\u002Fjetbrains","1.notes\u002Fdevelopment\u002FIDE\u002Fjetbrains",{"title":67,"path":68,"stem":69},"NVIM","\u002Fnotes\u002Fdevelopment\u002Fide\u002Fnvim","1.notes\u002Fdevelopment\u002FIDE\u002Fnvim",{"title":71,"path":72,"stem":73},"tmux","\u002Fnotes\u002Fdevelopment\u002Fide\u002Ftmux","1.notes\u002Fdevelopment\u002FIDE\u002Ftmux",{"title":75,"path":76,"stem":77,"children":78,"page":30},"Algo","\u002Fnotes\u002Fdevelopment\u002Falgo","1.notes\u002Fdevelopment\u002Falgo",[79,83,87,91,95],{"title":80,"path":81,"stem":82},"Algorithms","\u002Fnotes\u002Fdevelopment\u002Falgo\u002Falgorithms","1.notes\u002Fdevelopment\u002Falgo\u002Falgorithms",{"title":84,"path":85,"stem":86},"Data Structures","\u002Fnotes\u002Fdevelopment\u002Falgo\u002Fdata_structures","1.notes\u002Fdevelopment\u002Falgo\u002Fdata_structures",{"title":88,"path":89,"stem":90},"Kata","\u002Fnotes\u002Fdevelopment\u002Falgo\u002Fkata","1.notes\u002Fdevelopment\u002Falgo\u002Fkata",{"title":92,"path":93,"stem":94},"O-notation","\u002Fnotes\u002Fdevelopment\u002Falgo\u002Fo-notation","1.notes\u002Fdevelopment\u002Falgo\u002Fo-notation",{"title":96,"path":97,"stem":98,"children":99,"page":30},"Sorting","\u002Fnotes\u002Fdevelopment\u002Falgo\u002Fsorting","1.notes\u002Fdevelopment\u002Falgo\u002Fsorting",[100,104,108],{"title":101,"path":102,"stem":103},"Buble Sort","\u002Fnotes\u002Fdevelopment\u002Falgo\u002Fsorting\u002Fbublesort","1.notes\u002Fdevelopment\u002Falgo\u002Fsorting\u002Fbublesort",{"title":105,"path":106,"stem":107},"Merge Sort","\u002Fnotes\u002Fdevelopment\u002Falgo\u002Fsorting\u002Fmergesort","1.notes\u002Fdevelopment\u002Falgo\u002Fsorting\u002Fmergesort",{"title":109,"path":110,"stem":111},"Quicksort","\u002Fnotes\u002Fdevelopment\u002Falgo\u002Fsorting\u002Fquicksort","1.notes\u002Fdevelopment\u002Falgo\u002Fsorting\u002Fquicksort",{"title":113,"path":114,"stem":115,"children":116,"page":30},"DataStructures","\u002Fnotes\u002Fdevelopment\u002Fdata_structures","1.notes\u002Fdevelopment\u002Fdata_structures",[117,121,125,129,133,137,141,145],{"title":118,"path":119,"stem":120},"ArrayList","\u002Fnotes\u002Fdevelopment\u002Fdata_structures\u002Farray_list","1.notes\u002Fdevelopment\u002Fdata_structures\u002Farray_list",{"title":122,"path":123,"stem":124},"Arrays","\u002Fnotes\u002Fdevelopment\u002Fdata_structures\u002Farrays","1.notes\u002Fdevelopment\u002Fdata_structures\u002Farrays",{"title":126,"path":127,"stem":128},"HashSet","\u002Fnotes\u002Fdevelopment\u002Fdata_structures\u002Fhash_set","1.notes\u002Fdevelopment\u002Fdata_structures\u002Fhash_set",{"title":130,"path":131,"stem":132},"LinkedList","\u002Fnotes\u002Fdevelopment\u002Fdata_structures\u002Flinked_list","1.notes\u002Fdevelopment\u002Fdata_structures\u002Flinked_list",{"title":134,"path":135,"stem":136},"PriorityQueue","\u002Fnotes\u002Fdevelopment\u002Fdata_structures\u002Fpriority_queue","1.notes\u002Fdevelopment\u002Fdata_structures\u002Fpriority_queue",{"title":138,"path":139,"stem":140},"Stack","\u002Fnotes\u002Fdevelopment\u002Fdata_structures\u002Fstack","1.notes\u002Fdevelopment\u002Fdata_structures\u002Fstack",{"title":142,"path":143,"stem":144},"TreeSet","\u002Fnotes\u002Fdevelopment\u002Fdata_structures\u002Ftree_set","1.notes\u002Fdevelopment\u002Fdata_structures\u002Ftree_set",{"title":146,"path":147,"stem":148},"Vector","\u002Fnotes\u002Fdevelopment\u002Fdata_structures\u002Fvector","1.notes\u002Fdevelopment\u002Fdata_structures\u002Fvector",{"title":150,"path":151,"stem":152,"children":153,"page":30},"Java","\u002Fnotes\u002Fdevelopment\u002Fjava","1.notes\u002Fdevelopment\u002Fjava",[154,158,162,166,170,174,178,182,186,190,194,198,202,206,210,214,218,222],{"title":155,"path":156,"stem":157},"Bit Operations","\u002Fnotes\u002Fdevelopment\u002Fjava\u002Fbit-operations","1.notes\u002Fdevelopment\u002Fjava\u002Fbit-operations",{"title":159,"path":160,"stem":161},"Cheatsheet","\u002Fnotes\u002Fdevelopment\u002Fjava\u002Fcheatsheet","1.notes\u002Fdevelopment\u002Fjava\u002Fcheatsheet",{"title":163,"path":164,"stem":165},"Clean Code","\u002Fnotes\u002Fdevelopment\u002Fjava\u002Fclean-code-presentation","1.notes\u002Fdevelopment\u002Fjava\u002Fclean-code-presentation",{"title":167,"path":168,"stem":169},"Java Datasource","\u002Fnotes\u002Fdevelopment\u002Fjava\u002Fdata-sources","1.notes\u002Fdevelopment\u002Fjava\u002Fdata-sources",{"title":171,"path":172,"stem":173},"Dependency Injection","\u002Fnotes\u002Fdevelopment\u002Fjava\u002Fdependency-injection-presentation","1.notes\u002Fdevelopment\u002Fjava\u002Fdependency-injection-presentation",{"title":175,"path":176,"stem":177},"Java SE","\u002Fnotes\u002Fdevelopment\u002Fjava\u002Fjava-standard-edition","1.notes\u002Fdevelopment\u002Fjava\u002Fjava-standard-edition",{"title":179,"path":180,"stem":181},"Java Memory Model","\u002Fnotes\u002Fdevelopment\u002Fjava\u002Fjmm","1.notes\u002Fdevelopment\u002Fjava\u002Fjmm",{"title":183,"path":184,"stem":185},"JPA","\u002Fnotes\u002Fdevelopment\u002Fjava\u002Fjpa","1.notes\u002Fdevelopment\u002Fjava\u002Fjpa",{"title":187,"path":188,"stem":189},"Keywords","\u002Fnotes\u002Fdevelopment\u002Fjava\u002Fkeywords","1.notes\u002Fdevelopment\u002Fjava\u002Fkeywords",{"title":191,"path":192,"stem":193},"Maven","\u002Fnotes\u002Fdevelopment\u002Fjava\u002Fmaven","1.notes\u002Fdevelopment\u002Fjava\u002Fmaven",{"title":195,"path":196,"stem":197},"Spring AOP","\u002Fnotes\u002Fdevelopment\u002Fjava\u002Fspring-aop-presentation","1.notes\u002Fdevelopment\u002Fjava\u002Fspring-aop-presentation",{"title":199,"path":200,"stem":201},"Spring Boot","\u002Fnotes\u002Fdevelopment\u002Fjava\u002Fspring-boot","1.notes\u002Fdevelopment\u002Fjava\u002Fspring-boot",{"title":203,"path":204,"stem":205},"Spring Core","\u002Fnotes\u002Fdevelopment\u002Fjava\u002Fspring-core-presentation","1.notes\u002Fdevelopment\u002Fjava\u002Fspring-core-presentation",{"title":207,"path":208,"stem":209},"Spring Data","\u002Fnotes\u002Fdevelopment\u002Fjava\u002Fspring-data","1.notes\u002Fdevelopment\u002Fjava\u002Fspring-data",{"title":211,"path":212,"stem":213},"Spring JDBC","\u002Fnotes\u002Fdevelopment\u002Fjava\u002Fspring-jdbc","1.notes\u002Fdevelopment\u002Fjava\u002Fspring-jdbc",{"title":215,"path":216,"stem":217},"Spring MVC","\u002Fnotes\u002Fdevelopment\u002Fjava\u002Fspring-mvc-presentation","1.notes\u002Fdevelopment\u002Fjava\u002Fspring-mvc-presentation",{"title":219,"path":220,"stem":221},"Spring Security","\u002Fnotes\u002Fdevelopment\u002Fjava\u002Fspring-security","1.notes\u002Fdevelopment\u002Fjava\u002Fspring-security",{"title":223,"path":224,"stem":225},"Testing","\u002Fnotes\u002Fdevelopment\u002Fjava\u002Ftesting","1.notes\u002Fdevelopment\u002Fjava\u002Ftesting",{"title":227,"path":228,"stem":229,"children":230,"page":30},"Js","\u002Fnotes\u002Fdevelopment\u002Fjs","1.notes\u002Fdevelopment\u002Fjs",[231,235],{"title":232,"path":233,"stem":234},"JavaScript","\u002Fnotes\u002Fdevelopment\u002Fjs\u002Fjava-script","1.notes\u002Fdevelopment\u002Fjs\u002Fjava-script",{"title":236,"path":237,"stem":238},"NodeJS","\u002Fnotes\u002Fdevelopment\u002Fjs\u002Fnode-js","1.notes\u002Fdevelopment\u002Fjs\u002Fnode-js",{"title":240,"path":241,"stem":242,"children":243,"page":30},"PowerPlatform","\u002Fnotes\u002Fdevelopment\u002Fpower_platform","1.notes\u002Fdevelopment\u002Fpower_platform",[244,248,252,256],{"title":245,"path":246,"stem":247},"Power Apps","\u002Fnotes\u002Fdevelopment\u002Fpower_platform\u002Fpower-apps","1.notes\u002Fdevelopment\u002Fpower_platform\u002Fpower-apps",{"title":249,"path":250,"stem":251},"Power Automate","\u002Fnotes\u002Fdevelopment\u002Fpower_platform\u002Fpower-automate","1.notes\u002Fdevelopment\u002Fpower_platform\u002Fpower-automate",{"title":253,"path":254,"stem":255},"Power BI","\u002Fnotes\u002Fdevelopment\u002Fpower_platform\u002Fpower-bi","1.notes\u002Fdevelopment\u002Fpower_platform\u002Fpower-bi",{"title":257,"path":258,"stem":259},"Sharepoint","\u002Fnotes\u002Fdevelopment\u002Fpower_platform\u002Fsharepoint","1.notes\u002Fdevelopment\u002Fpower_platform\u002Fsharepoint",{"title":261,"path":262,"stem":263},"Python","\u002Fnotes\u002Fdevelopment\u002Fpython","1.notes\u002Fdevelopment\u002Fpython",{"title":265,"path":266,"stem":267,"children":268,"page":30},"Devops","\u002Fnotes\u002Fdevops","1.notes\u002Fdevops",[269,273,277,281,285,289,293,297,306],{"title":270,"path":271,"stem":272},"Containers","\u002Fnotes\u002Fdevops\u002Fcontainers","1.notes\u002Fdevops\u002Fcontainers",{"title":274,"path":275,"stem":276},"Curl","\u002Fnotes\u002Fdevops\u002Fcurl","1.notes\u002Fdevops\u002Fcurl",{"title":278,"path":279,"stem":280},"GCP","\u002Fnotes\u002Fdevops\u002Fgcp","1.notes\u002Fdevops\u002Fgcp",{"title":282,"path":283,"stem":284},"GIT","\u002Fnotes\u002Fdevops\u002Fgit","1.notes\u002Fdevops\u002Fgit",{"title":286,"path":287,"stem":288},"Jenkins","\u002Fnotes\u002Fdevops\u002Fjenkins","1.notes\u002Fdevops\u002Fjenkins",{"title":290,"path":291,"stem":292},"Kubernetes","\u002Fnotes\u002Fdevops\u002Fkubernetes","1.notes\u002Fdevops\u002Fkubernetes",{"title":294,"path":295,"stem":296},"Linux","\u002Fnotes\u002Fdevops\u002Flinux","1.notes\u002Fdevops\u002Flinux",{"title":298,"path":299,"stem":300,"children":301,"page":30},"Os","\u002Fnotes\u002Fdevops\u002Fos","1.notes\u002Fdevops\u002Fos",[302],{"title":303,"path":304,"stem":305},"MAC OS","\u002Fnotes\u002Fdevops\u002Fos\u002Fmacos","1.notes\u002Fdevops\u002Fos\u002Fmacos",{"title":307,"path":308,"stem":309},"WSL","\u002Fnotes\u002Fdevops\u002Fwsl","1.notes\u002Fdevops\u002Fwsl",{"title":311,"path":312,"stem":313,"children":314,"page":30},"Hardware","\u002Fnotes\u002Fhardware","1.notes\u002Fhardware",[315],{"title":316,"path":317,"stem":318},"Keyboard","\u002Fnotes\u002Fhardware\u002Fkeyboard","1.notes\u002Fhardware\u002Fkeyboard",{"title":320,"path":321,"stem":322,"children":323,"page":30},"Homelab","\u002Fnotes\u002Fhomelab","1.notes\u002Fhomelab",[324,328,337,350],{"title":325,"path":326,"stem":327},"Proxmox","\u002Fnotes\u002Fhomelab\u002F_-proxmox-1","1.notes\u002Fhomelab\u002F_ proxmox 1",{"title":329,"path":330,"stem":331,"children":332,"page":30},"Cloudflare","\u002Fnotes\u002Fhomelab\u002Fcloudflare","1.notes\u002Fhomelab\u002Fcloudflare",[333],{"title":334,"path":335,"stem":336},"Cloudflare Workers","\u002Fnotes\u002Fhomelab\u002Fcloudflare\u002Fworkers","1.notes\u002Fhomelab\u002Fcloudflare\u002Fworkers",{"title":338,"path":339,"stem":340,"children":341,"page":30},"HomeAssistant","\u002Fnotes\u002Fhomelab\u002Fhome_assistant","1.notes\u002Fhomelab\u002Fhome_assistant",[342,346],{"title":343,"path":344,"stem":345},"EspHome debugger","\u002Fnotes\u002Fhomelab\u002Fhome_assistant\u002Fesphome-debugger","1.notes\u002Fhomelab\u002Fhome_assistant\u002Fesphome-debugger",{"title":347,"path":348,"stem":349},"GIT integration","\u002Fnotes\u002Fhomelab\u002Fhome_assistant\u002Fgit-integration","1.notes\u002Fhomelab\u002Fhome_assistant\u002Fgit-integration",{"title":325,"path":351,"stem":352,"children":353},"\u002Fnotes\u002Fhomelab\u002Fproxmox","1.notes\u002Fhomelab\u002Fproxmox",[354,358,362,365,369,373,377],{"title":355,"path":356,"stem":357},"Issue: TASK ERROR: Device \u002Fdev\u002Fdri\u002Fcard1 does not exist","\u002Fnotes\u002Fhomelab\u002Fproxmox\u002Fissue_task_error_device_dev_dri_card1_does-not-exist","1.notes\u002Fhomelab\u002Fproxmox\u002FIssue_TASK_ERROR_device_dev_dri_card1_does not exist",{"title":359,"path":360,"stem":361},"Mount USB Drive To LXC Container","\u002Fnotes\u002Fhomelab\u002Fproxmox\u002Fmount-usb-drive-to-lxc-container","1.notes\u002Fhomelab\u002Fproxmox\u002FMount USB drive to LXC container",{"title":325,"path":363,"stem":364},"\u002Fnotes\u002Fhomelab\u002Fproxmox\u002F_-proxmox","1.notes\u002Fhomelab\u002Fproxmox\u002F_ proxmox",{"title":366,"path":367,"stem":368},"ARR","\u002Fnotes\u002Fhomelab\u002Fproxmox\u002Farr","1.notes\u002Fhomelab\u002Fproxmox\u002Farr",{"title":370,"path":371,"stem":372},"Auto login via SSH from Proxmox UI","\u002Fnotes\u002Fhomelab\u002Fproxmox\u002Fauto_login_via_ssh_from_proxmox_ui","1.notes\u002Fhomelab\u002Fproxmox\u002Fauto_login_via_ssh_from_proxmox_ui",{"title":374,"path":375,"stem":376},"Installation","\u002Fnotes\u002Fhomelab\u002Fproxmox\u002Fdokploy","1.notes\u002Fhomelab\u002Fproxmox\u002Fdokploy",{"title":290,"path":378,"stem":379},"\u002Fnotes\u002Fhomelab\u002Fproxmox\u002Fkubernetes","1.notes\u002Fhomelab\u002Fproxmox\u002Fkubernetes",{"title":381,"path":382,"stem":383,"children":384,"page":30},"Leadership","\u002Fnotes\u002Fleadership","1.notes\u002Fleadership",[385,389,393],{"title":386,"path":387,"stem":388},"Leader Toolbox","\u002Fnotes\u002Fleadership\u002Fleader-toolbox","1.notes\u002Fleadership\u002Fleader-toolbox",{"title":390,"path":391,"stem":392},"Enterprise Project Structure","\u002Fnotes\u002Fleadership\u002Fproject-doc-structure","1.notes\u002Fleadership\u002Fproject-doc-structure",{"title":394,"path":395,"stem":396},"Scrum template","\u002Fnotes\u002Fleadership\u002Fscrum-template","1.notes\u002Fleadership\u002Fscrum-template",{"title":398,"path":399,"stem":400,"children":401,"page":30},"Products","\u002Fnotes\u002Fproducts","1.notes\u002Fproducts",[402],{"title":403,"path":404,"stem":405},"BigQuery","\u002Fnotes\u002Fproducts\u002Fgcp-big-query","1.notes\u002Fproducts\u002Fgcp-big-query",{"id":407,"title":408,"authors":409,"badge":409,"body":410,"date":1907,"description":1908,"extension":1909,"image":409,"meta":1910,"navigation":992,"path":1912,"seo":1913,"stem":1914,"__hash__":1915},"posts\u002F2.blog\u002F2012-02-02-fast-track-to-hibernate.md","Podstawowy projekt z użyciem Hibernate",null,{"type":411,"value":412,"toc":1905},"minimark",[413,417,420,423,566,569,572,663,666,952,955,970,973,976,1089,1092,1095,1175,1178,1240,1243,1246,1463,1470,1477,1504,1507,1510,1720,1723,1901],[414,415,416],"p",{},"W dzisiejszym poście zaprezentujemy jak stworzyć projekt, który może stanowić wejście dla przyszłych projektów wykorzystujących Hibernate oraz Mavena. Do zamockowania bazy danych posłużymy się wbudowaną (embeded) bazą danych – Derby.",[414,418,419],{},"##Nowy projekt",[414,421,422],{},"Nalezy utworzyć nowy projekt za pomoca polecenia:",[424,425,430],"pre",{"className":426,"code":427,"language":428,"meta":429,"style":429},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","mvn -DarchetypeGroupId=org.apache.maven.archetypes\n-DarchetypeArtifactId=maven-archetype-quickstart\n-DarchetypeVersion=1.1\n-DarchetypeRepository=http:\u002F\u002Frepo1.maven.org\u002Fmaven2\n-DgroupId=pl.xperios\n-DartifactId=HibernateMavenStarter\n-Dversion=1.0-SNAPSHOT\n-Dpackage=pl.xperios.HibernateMavenStarter\n-Dbasedir=C:\\\\Projects\\\\Starters\n-Darchetype.interactive=false –batch-mode archetype:generate\n","bash","",[431,432,433,446,460,471,482,493,504,515,526,548],"code",{"__ignoreMap":429},[434,435,438,442],"span",{"class":436,"line":437},"line",1,[434,439,441],{"class":440},"sBMFI","mvn",[434,443,445],{"class":444},"sfazB"," -DarchetypeGroupId=org.apache.maven.archetypes\n",[434,447,449,453,457],{"class":436,"line":448},2,[434,450,452],{"class":451},"sTEyZ","-DarchetypeArtifactId",[434,454,456],{"class":455},"sMK4o","=",[434,458,459],{"class":444},"maven-archetype-quickstart\n",[434,461,463,466,468],{"class":436,"line":462},3,[434,464,465],{"class":451},"-DarchetypeVersion",[434,467,456],{"class":455},[434,469,470],{"class":444},"1.1\n",[434,472,474,477,479],{"class":436,"line":473},4,[434,475,476],{"class":451},"-DarchetypeRepository",[434,478,456],{"class":455},[434,480,481],{"class":444},"http:\u002F\u002Frepo1.maven.org\u002Fmaven2\n",[434,483,485,488,490],{"class":436,"line":484},5,[434,486,487],{"class":451},"-DgroupId",[434,489,456],{"class":455},[434,491,492],{"class":444},"pl.xperios\n",[434,494,496,499,501],{"class":436,"line":495},6,[434,497,498],{"class":451},"-DartifactId",[434,500,456],{"class":455},[434,502,503],{"class":444},"HibernateMavenStarter\n",[434,505,507,510,512],{"class":436,"line":506},7,[434,508,509],{"class":451},"-Dversion",[434,511,456],{"class":455},[434,513,514],{"class":444},"1.0-SNAPSHOT\n",[434,516,518,521,523],{"class":436,"line":517},8,[434,519,520],{"class":451},"-Dpackage",[434,522,456],{"class":455},[434,524,525],{"class":444},"pl.xperios.HibernateMavenStarter\n",[434,527,529,532,534,537,540,543,545],{"class":436,"line":528},9,[434,530,531],{"class":451},"-Dbasedir",[434,533,456],{"class":455},[434,535,536],{"class":444},"C:",[434,538,539],{"class":451},"\\\\",[434,541,542],{"class":444},"Projects",[434,544,539],{"class":451},[434,546,547],{"class":444},"Starters\n",[434,549,551,554,556,560,563],{"class":436,"line":550},10,[434,552,553],{"class":440},"-Darchetype.interactive",[434,555,456],{"class":444},[434,557,559],{"class":558},"s2Zo4","false",[434,561,562],{"class":444}," –batch-mode",[434,564,565],{"class":444}," archetype:generate\n",[414,567,568],{},"##Konfiguracja zależności",[414,570,571],{},"Po stworzeniu struktury projektu należy dodać zależności Hibernate. Ponieważ nie występują w repozytorium centralnym najpierw należy dodać odpowiednie repozytoria do pliku pom.xml:",[424,573,577],{"className":574,"code":575,"language":576,"meta":429,"style":429},"language-xml shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","    \u003Crepositories>\n        \u003Crepository>\n            \u003Cid>sonatype-snapshots\u003C\u002Fid>\n            \u003Cname>Sonatype Snapshots\u003C\u002Fname>\n            \u003Curl>https:\u002F\u002Foss.sonatype.org\u002Fcontent\u002Frepositories\u002Fsnapshots\u002F\u003C\u002Furl>\n            \u003Csnapshots>\n                \u003Cenabled>true\u003C\u002Fenabled>\n            \u003C\u002Fsnapshots>\n        \u003C\u002Frepository>\n        \u003Crepository>\n            \u003Curl>http:\u002F\u002Fdownload.java.net\u002Fmaven\u002F2\u002F\u003C\u002Furl>\n            \u003Cid>download.java.net\u003C\u002Fid>\n            \u003Clayout>default\u003C\u002Flayout>\n            \u003Cname>Hibernate support\u003C\u002Fname>\n        \u003C\u002Frepository>\n    \u003C\u002Frepositories>\n","xml",[431,578,579,584,589,594,599,604,609,614,619,624,628,634,640,646,652,657],{"__ignoreMap":429},[434,580,581],{"class":436,"line":437},[434,582,583],{},"    \u003Crepositories>\n",[434,585,586],{"class":436,"line":448},[434,587,588],{},"        \u003Crepository>\n",[434,590,591],{"class":436,"line":462},[434,592,593],{},"            \u003Cid>sonatype-snapshots\u003C\u002Fid>\n",[434,595,596],{"class":436,"line":473},[434,597,598],{},"            \u003Cname>Sonatype Snapshots\u003C\u002Fname>\n",[434,600,601],{"class":436,"line":484},[434,602,603],{},"            \u003Curl>https:\u002F\u002Foss.sonatype.org\u002Fcontent\u002Frepositories\u002Fsnapshots\u002F\u003C\u002Furl>\n",[434,605,606],{"class":436,"line":495},[434,607,608],{},"            \u003Csnapshots>\n",[434,610,611],{"class":436,"line":506},[434,612,613],{},"                \u003Cenabled>true\u003C\u002Fenabled>\n",[434,615,616],{"class":436,"line":517},[434,617,618],{},"            \u003C\u002Fsnapshots>\n",[434,620,621],{"class":436,"line":528},[434,622,623],{},"        \u003C\u002Frepository>\n",[434,625,626],{"class":436,"line":550},[434,627,588],{},[434,629,631],{"class":436,"line":630},11,[434,632,633],{},"            \u003Curl>http:\u002F\u002Fdownload.java.net\u002Fmaven\u002F2\u002F\u003C\u002Furl>\n",[434,635,637],{"class":436,"line":636},12,[434,638,639],{},"            \u003Cid>download.java.net\u003C\u002Fid>\n",[434,641,643],{"class":436,"line":642},13,[434,644,645],{},"            \u003Clayout>default\u003C\u002Flayout>\n",[434,647,649],{"class":436,"line":648},14,[434,650,651],{},"            \u003Cname>Hibernate support\u003C\u002Fname>\n",[434,653,655],{"class":436,"line":654},15,[434,656,623],{},[434,658,660],{"class":436,"line":659},16,[434,661,662],{},"    \u003C\u002Frepositories>\n",[414,664,665],{},"Od tej pory do projektu możemy dołączać również zależności, które nie znajdują się w repozytorium centralnym:",[424,667,669],{"className":574,"code":668,"language":576,"meta":429,"style":429},"\u003Cdependencies>\n        \u003Cdependency>\n            \u003CgroupId>junit\u003C\u002FgroupId>\n            \u003CartifactId>junit\u003C\u002FartifactId>\n            \u003Cversion>3.8.1\u003C\u002Fversion>\n            \u003Cscope>test\u003C\u002Fscope>\n        \u003C\u002Fdependency>\n        \u003Cdependency>\n            \u003CgroupId>log4j\u003C\u002FgroupId>\n            \u003CartifactId>log4j\u003C\u002FartifactId>\n            \u003Cversion>1.2.16\u003C\u002Fversion>\n        \u003C\u002Fdependency>\n        \u003Cdependency>\n            \u003CgroupId>org.slf4j\u003C\u002FgroupId>\n            \u003CartifactId>slf4j-log4j12\u003C\u002FartifactId>\n            \u003Cversion>1.5.6\u003C\u002Fversion>\n        \u003C\u002Fdependency>\n        \u003Cdependency>\n            \u003CgroupId>org.hibernate\u003C\u002FgroupId>\n            \u003CartifactId>hibernate\u003C\u002FartifactId>\n            \u003Cversion>3.2.5.ga\u003C\u002Fversion>\n        \u003C\u002Fdependency>\n        \u003Cdependency>\n            \u003CgroupId>org.hibernate\u003C\u002FgroupId>\n            \u003CartifactId>hibernate-entitymanager\u003C\u002FartifactId>\n            \u003Cversion>3.3.2.GA\u003C\u002Fversion>\n        \u003C\u002Fdependency>\n        \u003Cdependency>\n            \u003CgroupId>org.hibernate\u003C\u002FgroupId>\n            \u003CartifactId>hibernate-validator\u003C\u002FartifactId>\n            \u003Cversion>4.1.0.Final\u003C\u002Fversion>\n        \u003C\u002Fdependency>\n        \u003Cdependency>\n            \u003CgroupId>javax.sql\u003C\u002FgroupId>\n            \u003CartifactId>jdbc-stdext\u003C\u002FartifactId>\n            \u003Cversion>2.0\u003C\u002Fversion>\n        \u003C\u002Fdependency>\n        \u003Cdependency>\n            \u003CgroupId>javax.transaction\u003C\u002FgroupId>\n            \u003CartifactId>jta\u003C\u002FartifactId>\n            \u003Cversion>1.0.1B\u003C\u002Fversion>\n        \u003C\u002Fdependency>\n        \u003Cdependency>\n            \u003CgroupId>org.hibernate\u003C\u002FgroupId>\n            \u003CartifactId>ejb3-persistence\u003C\u002FartifactId>\n            \u003Cversion>1.0.1.GA\u003C\u002Fversion>\n        \u003C\u002Fdependency>\n        \u003Cdependency>\n            \u003CgroupId>org.apache.derby\u003C\u002FgroupId>\n            \u003CartifactId>derbyclient\u003C\u002FartifactId>\n            \u003Cversion>10.8.1.2\u003C\u002Fversion>\n        \u003C\u002Fdependency>\n    \u003C\u002Fdependencies>\n",[431,670,671,676,681,686,691,696,701,706,710,715,720,725,729,733,738,743,748,753,758,764,770,776,781,786,791,797,803,808,813,818,824,830,835,840,846,852,858,863,868,874,880,886,891,896,901,907,913,918,923,929,935,941,946],{"__ignoreMap":429},[434,672,673],{"class":436,"line":437},[434,674,675],{},"\u003Cdependencies>\n",[434,677,678],{"class":436,"line":448},[434,679,680],{},"        \u003Cdependency>\n",[434,682,683],{"class":436,"line":462},[434,684,685],{},"            \u003CgroupId>junit\u003C\u002FgroupId>\n",[434,687,688],{"class":436,"line":473},[434,689,690],{},"            \u003CartifactId>junit\u003C\u002FartifactId>\n",[434,692,693],{"class":436,"line":484},[434,694,695],{},"            \u003Cversion>3.8.1\u003C\u002Fversion>\n",[434,697,698],{"class":436,"line":495},[434,699,700],{},"            \u003Cscope>test\u003C\u002Fscope>\n",[434,702,703],{"class":436,"line":506},[434,704,705],{},"        \u003C\u002Fdependency>\n",[434,707,708],{"class":436,"line":517},[434,709,680],{},[434,711,712],{"class":436,"line":528},[434,713,714],{},"            \u003CgroupId>log4j\u003C\u002FgroupId>\n",[434,716,717],{"class":436,"line":550},[434,718,719],{},"            \u003CartifactId>log4j\u003C\u002FartifactId>\n",[434,721,722],{"class":436,"line":630},[434,723,724],{},"            \u003Cversion>1.2.16\u003C\u002Fversion>\n",[434,726,727],{"class":436,"line":636},[434,728,705],{},[434,730,731],{"class":436,"line":642},[434,732,680],{},[434,734,735],{"class":436,"line":648},[434,736,737],{},"            \u003CgroupId>org.slf4j\u003C\u002FgroupId>\n",[434,739,740],{"class":436,"line":654},[434,741,742],{},"            \u003CartifactId>slf4j-log4j12\u003C\u002FartifactId>\n",[434,744,745],{"class":436,"line":659},[434,746,747],{},"            \u003Cversion>1.5.6\u003C\u002Fversion>\n",[434,749,751],{"class":436,"line":750},17,[434,752,705],{},[434,754,756],{"class":436,"line":755},18,[434,757,680],{},[434,759,761],{"class":436,"line":760},19,[434,762,763],{},"            \u003CgroupId>org.hibernate\u003C\u002FgroupId>\n",[434,765,767],{"class":436,"line":766},20,[434,768,769],{},"            \u003CartifactId>hibernate\u003C\u002FartifactId>\n",[434,771,773],{"class":436,"line":772},21,[434,774,775],{},"            \u003Cversion>3.2.5.ga\u003C\u002Fversion>\n",[434,777,779],{"class":436,"line":778},22,[434,780,705],{},[434,782,784],{"class":436,"line":783},23,[434,785,680],{},[434,787,789],{"class":436,"line":788},24,[434,790,763],{},[434,792,794],{"class":436,"line":793},25,[434,795,796],{},"            \u003CartifactId>hibernate-entitymanager\u003C\u002FartifactId>\n",[434,798,800],{"class":436,"line":799},26,[434,801,802],{},"            \u003Cversion>3.3.2.GA\u003C\u002Fversion>\n",[434,804,806],{"class":436,"line":805},27,[434,807,705],{},[434,809,811],{"class":436,"line":810},28,[434,812,680],{},[434,814,816],{"class":436,"line":815},29,[434,817,763],{},[434,819,821],{"class":436,"line":820},30,[434,822,823],{},"            \u003CartifactId>hibernate-validator\u003C\u002FartifactId>\n",[434,825,827],{"class":436,"line":826},31,[434,828,829],{},"            \u003Cversion>4.1.0.Final\u003C\u002Fversion>\n",[434,831,833],{"class":436,"line":832},32,[434,834,705],{},[434,836,838],{"class":436,"line":837},33,[434,839,680],{},[434,841,843],{"class":436,"line":842},34,[434,844,845],{},"            \u003CgroupId>javax.sql\u003C\u002FgroupId>\n",[434,847,849],{"class":436,"line":848},35,[434,850,851],{},"            \u003CartifactId>jdbc-stdext\u003C\u002FartifactId>\n",[434,853,855],{"class":436,"line":854},36,[434,856,857],{},"            \u003Cversion>2.0\u003C\u002Fversion>\n",[434,859,861],{"class":436,"line":860},37,[434,862,705],{},[434,864,866],{"class":436,"line":865},38,[434,867,680],{},[434,869,871],{"class":436,"line":870},39,[434,872,873],{},"            \u003CgroupId>javax.transaction\u003C\u002FgroupId>\n",[434,875,877],{"class":436,"line":876},40,[434,878,879],{},"            \u003CartifactId>jta\u003C\u002FartifactId>\n",[434,881,883],{"class":436,"line":882},41,[434,884,885],{},"            \u003Cversion>1.0.1B\u003C\u002Fversion>\n",[434,887,889],{"class":436,"line":888},42,[434,890,705],{},[434,892,894],{"class":436,"line":893},43,[434,895,680],{},[434,897,899],{"class":436,"line":898},44,[434,900,763],{},[434,902,904],{"class":436,"line":903},45,[434,905,906],{},"            \u003CartifactId>ejb3-persistence\u003C\u002FartifactId>\n",[434,908,910],{"class":436,"line":909},46,[434,911,912],{},"            \u003Cversion>1.0.1.GA\u003C\u002Fversion>\n",[434,914,916],{"class":436,"line":915},47,[434,917,705],{},[434,919,921],{"class":436,"line":920},48,[434,922,680],{},[434,924,926],{"class":436,"line":925},49,[434,927,928],{},"            \u003CgroupId>org.apache.derby\u003C\u002FgroupId>\n",[434,930,932],{"class":436,"line":931},50,[434,933,934],{},"            \u003CartifactId>derbyclient\u003C\u002FartifactId>\n",[434,936,938],{"class":436,"line":937},51,[434,939,940],{},"            \u003Cversion>10.8.1.2\u003C\u002Fversion>\n",[434,942,944],{"class":436,"line":943},52,[434,945,705],{},[434,947,949],{"class":436,"line":948},53,[434,950,951],{},"    \u003C\u002Fdependencies>\n",[414,953,954],{},"Po zapisaniu projektu i pierwszej kompilacji zostaną pobrane zależności do lokalnego repozytorium. W tym celu należy wydać polecenie:",[424,956,958],{"className":426,"code":957,"language":428,"meta":429,"style":429},"mvn clean install\n",[431,959,960],{"__ignoreMap":429},[434,961,962,964,967],{"class":436,"line":437},[434,963,441],{"class":440},[434,965,966],{"class":444}," clean",[434,968,969],{"class":444}," install\n",[414,971,972],{},"##Klasa pomocnicza HibernateUtil",[414,974,975],{},"Pracę zaczynamy od stworzenia specjalnej klasy narzędziowej, która inicjuje konfigurację oraz pozwala na dostęp do usług Hibernate poprzez metody statyczne:",[424,977,981],{"className":978,"code":979,"language":980,"meta":429,"style":429},"language-java shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","package pl.xperios.hibernatestarter;\n\nimport org.hibernate.cfg.AnnotationConfiguration;\nimport org.hibernate.SessionFactory;\n\npublic class HibernateUtil {\n\n    private static final SessionFactory sessionFactory;\n\n    static {\n        try {\n            sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();\n        } catch (Throwable ex) {\n            System.err.println(\"Initial SessionFactory creation failed.\" + ex);\n            throw new ExceptionInInitializerError(ex);\n        }\n    }\n\n    public static SessionFactory getSessionFactory() {\n        return sessionFactory;\n    }\n}\n","java",[431,982,983,988,994,999,1004,1008,1013,1017,1022,1026,1031,1036,1041,1046,1051,1056,1061,1066,1070,1075,1080,1084],{"__ignoreMap":429},[434,984,985],{"class":436,"line":437},[434,986,987],{},"package pl.xperios.hibernatestarter;\n",[434,989,990],{"class":436,"line":448},[434,991,993],{"emptyLinePlaceholder":992},true,"\n",[434,995,996],{"class":436,"line":462},[434,997,998],{},"import org.hibernate.cfg.AnnotationConfiguration;\n",[434,1000,1001],{"class":436,"line":473},[434,1002,1003],{},"import org.hibernate.SessionFactory;\n",[434,1005,1006],{"class":436,"line":484},[434,1007,993],{"emptyLinePlaceholder":992},[434,1009,1010],{"class":436,"line":495},[434,1011,1012],{},"public class HibernateUtil {\n",[434,1014,1015],{"class":436,"line":506},[434,1016,993],{"emptyLinePlaceholder":992},[434,1018,1019],{"class":436,"line":517},[434,1020,1021],{},"    private static final SessionFactory sessionFactory;\n",[434,1023,1024],{"class":436,"line":528},[434,1025,993],{"emptyLinePlaceholder":992},[434,1027,1028],{"class":436,"line":550},[434,1029,1030],{},"    static {\n",[434,1032,1033],{"class":436,"line":630},[434,1034,1035],{},"        try {\n",[434,1037,1038],{"class":436,"line":636},[434,1039,1040],{},"            sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();\n",[434,1042,1043],{"class":436,"line":642},[434,1044,1045],{},"        } catch (Throwable ex) {\n",[434,1047,1048],{"class":436,"line":648},[434,1049,1050],{},"            System.err.println(\"Initial SessionFactory creation failed.\" + ex);\n",[434,1052,1053],{"class":436,"line":654},[434,1054,1055],{},"            throw new ExceptionInInitializerError(ex);\n",[434,1057,1058],{"class":436,"line":659},[434,1059,1060],{},"        }\n",[434,1062,1063],{"class":436,"line":750},[434,1064,1065],{},"    }\n",[434,1067,1068],{"class":436,"line":755},[434,1069,993],{"emptyLinePlaceholder":992},[434,1071,1072],{"class":436,"line":760},[434,1073,1074],{},"    public static SessionFactory getSessionFactory() {\n",[434,1076,1077],{"class":436,"line":766},[434,1078,1079],{},"        return sessionFactory;\n",[434,1081,1082],{"class":436,"line":772},[434,1083,1065],{},[434,1085,1086],{"class":436,"line":778},[434,1087,1088],{},"}\n",[414,1090,1091],{},"##Konfiguracja Hibernate",[414,1093,1094],{},"Powyższa klasa inicjuje konfigurację opartą na anotacjach a następnie odczytuje konfiguracje z jednego z możliwych źródeł. My posłużymy się plikiem konfiguracyjnym zawartym w pliku xml. W tym celu należy stworzyć plik hibernate.cfg.xml w folderze src\u002Fmain\u002Fresources o następującej treści:",[424,1096,1098],{"className":574,"code":1097,"language":576,"meta":429,"style":429},"\u003C?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\u003C!DOCTYPE hibernate-configuration PUBLIC \"-\u002F\u002FHibernate\u002FHibernate Configuration DTD 3.0\u002F\u002FEN\" \"http:\u002F\u002Fhibernate.sourceforge.net\u002Fhibernate-configuration-3.0.dtd\">\n\u003Chibernate-configuration>\n  \u003Csession-factory>\n    \u003Cproperty name=\"hibernate.dialect\">org.hibernate.dialect.DerbyDialect\u003C\u002Fproperty>\n    \u003Cproperty name=\"hibernate.connection.driver_class\">org.apache.derby.jdbc.ClientDriver\u003C\u002Fproperty>\n    \u003Cproperty name=\"hibernate.connection.url\">jdbc:derby:\u002F\u002Flocalhost:1527\u002Fsample\u003C\u002Fproperty>\n    \u003Cproperty name=\"hibernate.connection.username\">app\u003C\u002Fproperty>\n    \u003Cproperty name=\"hibernate.connection.password\">app\u003C\u002Fproperty>\n    \u003Cproperty name=\"hibernate.show_sql\">true\u003C\u002Fproperty>\n    \u003Cproperty name=\"hibernate.hbm2ddl.auto\">create-drop\u003C\u002Fproperty>\n    \u003Cproperty name=\"hibernate.current_session_context_class\">thread\u003C\u002Fproperty>\n    \u003Cproperty name=\"hibernate.transaction.auto_close_session\">true\u003C\u002Fproperty>\n  \u003C\u002Fsession-factory>\n\u003C\u002Fhibernate-configuration>\n",[431,1099,1100,1105,1110,1115,1120,1125,1130,1135,1140,1145,1150,1155,1160,1165,1170],{"__ignoreMap":429},[434,1101,1102],{"class":436,"line":437},[434,1103,1104],{},"\u003C?xml version=\"1.0\" encoding=\"UTF-8\"?>\n",[434,1106,1107],{"class":436,"line":448},[434,1108,1109],{},"\u003C!DOCTYPE hibernate-configuration PUBLIC \"-\u002F\u002FHibernate\u002FHibernate Configuration DTD 3.0\u002F\u002FEN\" \"http:\u002F\u002Fhibernate.sourceforge.net\u002Fhibernate-configuration-3.0.dtd\">\n",[434,1111,1112],{"class":436,"line":462},[434,1113,1114],{},"\u003Chibernate-configuration>\n",[434,1116,1117],{"class":436,"line":473},[434,1118,1119],{},"  \u003Csession-factory>\n",[434,1121,1122],{"class":436,"line":484},[434,1123,1124],{},"    \u003Cproperty name=\"hibernate.dialect\">org.hibernate.dialect.DerbyDialect\u003C\u002Fproperty>\n",[434,1126,1127],{"class":436,"line":495},[434,1128,1129],{},"    \u003Cproperty name=\"hibernate.connection.driver_class\">org.apache.derby.jdbc.ClientDriver\u003C\u002Fproperty>\n",[434,1131,1132],{"class":436,"line":506},[434,1133,1134],{},"    \u003Cproperty name=\"hibernate.connection.url\">jdbc:derby:\u002F\u002Flocalhost:1527\u002Fsample\u003C\u002Fproperty>\n",[434,1136,1137],{"class":436,"line":517},[434,1138,1139],{},"    \u003Cproperty name=\"hibernate.connection.username\">app\u003C\u002Fproperty>\n",[434,1141,1142],{"class":436,"line":528},[434,1143,1144],{},"    \u003Cproperty name=\"hibernate.connection.password\">app\u003C\u002Fproperty>\n",[434,1146,1147],{"class":436,"line":550},[434,1148,1149],{},"    \u003Cproperty name=\"hibernate.show_sql\">true\u003C\u002Fproperty>\n",[434,1151,1152],{"class":436,"line":630},[434,1153,1154],{},"    \u003Cproperty name=\"hibernate.hbm2ddl.auto\">create-drop\u003C\u002Fproperty>\n",[434,1156,1157],{"class":436,"line":636},[434,1158,1159],{},"    \u003Cproperty name=\"hibernate.current_session_context_class\">thread\u003C\u002Fproperty>\n",[434,1161,1162],{"class":436,"line":642},[434,1163,1164],{},"    \u003Cproperty name=\"hibernate.transaction.auto_close_session\">true\u003C\u002Fproperty>\n",[434,1166,1167],{"class":436,"line":648},[434,1168,1169],{},"  \u003C\u002Fsession-factory>\n",[434,1171,1172],{"class":436,"line":654},[434,1173,1174],{},"\u003C\u002Fhibernate-configuration>\n",[414,1176,1177],{},"Powyższy plik definiuje między innymi:",[1179,1180,1181,1185,1191,1197,1203,1209,1215,1221,1227,1234],"ul",{},[1182,1183,1184],"li",{},"połączenie z bazą danych:",[1182,1186,1187,1188],{},"sterownik ",[431,1189,1190],{},"hibernate.connection.driver_class",[1182,1192,1193,1194],{},"url ",[431,1195,1196],{},"hibernate.connection.url",[1182,1198,1199,1200],{},"login ",[431,1201,1202],{},"hibernate.connection.username",[1182,1204,1205,1206],{},"hasło ",[431,1207,1208],{},"hibernate.connection.password",[1182,1210,1211,1212],{},"dialekt ",[431,1213,1214],{},"hibernate.dialect",[1182,1216,1217,1218],{},"pokazywanie w konsoli wykonywanych zapytań do bazy ",[431,1219,1220],{},"hibernate.show_sql",[1182,1222,1223,1224],{},"kontekst aplikacji ",[431,1225,1226],{},"hibernate.current_session_context_class",[1182,1228,1229,1230,1233],{},"automatyczne zamykanie transakcji ",[431,1231,1232],{},"hibernate.transaction.auto_close_session",", które upraszcza obsługę transakcji",[1182,1235,1236,1237],{},"strategia zarządzania strukturą w bazie danych ",[431,1238,1239],{},"hibernate.hbm2ddl.auto",[414,1241,1242],{},"#Tworzenie pierwszej encji",[414,1244,1245],{},"W celu przetestowania poprawności konfiguracji stworzymy i zarejestrujemy prostą encję użytkownika naszej aplikacji. W tym celu stworzymy prostą klasę encji:",[424,1247,1249],{"className":978,"code":1248,"language":980,"meta":429,"style":429},"package pl.xperios.hibernatestarter.model;\n\nimport java.io.Serializable;\nimport javax.persistence.Entity;\nimport javax.persistence.GeneratedValue;\nimport javax.persistence.GenerationType;\nimport javax.persistence.Id;\n\n@Entity\npublic class UserData implements Serializable {\n\n    @Id\n    @GeneratedValue(strategy = GenerationType.AUTO)\n    Long userId;\n    String name;\n    String fullName;\n\n    public String getFullName() {\n        return fullName;\n    }\n\n    public void setFullName(String fullName) {\n        this.fullName = fullName;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    public Long getUserId() {\n        return userId;\n    }\n\n    public void setUserId(Long userId) {\n        this.userId = userId;\n    }\n\n    @Override\n    public String toString() {\n        return \"UserData{\" + \"userId=\" + userId + \", name=\" + name + \", fullName=\" + fullName + '}';\n    }\n}\n",[431,1250,1251,1256,1260,1265,1270,1275,1280,1285,1289,1294,1299,1303,1308,1313,1318,1323,1328,1332,1337,1342,1346,1350,1355,1360,1364,1368,1373,1378,1382,1386,1391,1396,1400,1404,1409,1414,1418,1422,1427,1432,1436,1440,1445,1450,1455,1459],{"__ignoreMap":429},[434,1252,1253],{"class":436,"line":437},[434,1254,1255],{},"package pl.xperios.hibernatestarter.model;\n",[434,1257,1258],{"class":436,"line":448},[434,1259,993],{"emptyLinePlaceholder":992},[434,1261,1262],{"class":436,"line":462},[434,1263,1264],{},"import java.io.Serializable;\n",[434,1266,1267],{"class":436,"line":473},[434,1268,1269],{},"import javax.persistence.Entity;\n",[434,1271,1272],{"class":436,"line":484},[434,1273,1274],{},"import javax.persistence.GeneratedValue;\n",[434,1276,1277],{"class":436,"line":495},[434,1278,1279],{},"import javax.persistence.GenerationType;\n",[434,1281,1282],{"class":436,"line":506},[434,1283,1284],{},"import javax.persistence.Id;\n",[434,1286,1287],{"class":436,"line":517},[434,1288,993],{"emptyLinePlaceholder":992},[434,1290,1291],{"class":436,"line":528},[434,1292,1293],{},"@Entity\n",[434,1295,1296],{"class":436,"line":550},[434,1297,1298],{},"public class UserData implements Serializable {\n",[434,1300,1301],{"class":436,"line":630},[434,1302,993],{"emptyLinePlaceholder":992},[434,1304,1305],{"class":436,"line":636},[434,1306,1307],{},"    @Id\n",[434,1309,1310],{"class":436,"line":642},[434,1311,1312],{},"    @GeneratedValue(strategy = GenerationType.AUTO)\n",[434,1314,1315],{"class":436,"line":648},[434,1316,1317],{},"    Long userId;\n",[434,1319,1320],{"class":436,"line":654},[434,1321,1322],{},"    String name;\n",[434,1324,1325],{"class":436,"line":659},[434,1326,1327],{},"    String fullName;\n",[434,1329,1330],{"class":436,"line":750},[434,1331,993],{"emptyLinePlaceholder":992},[434,1333,1334],{"class":436,"line":755},[434,1335,1336],{},"    public String getFullName() {\n",[434,1338,1339],{"class":436,"line":760},[434,1340,1341],{},"        return fullName;\n",[434,1343,1344],{"class":436,"line":766},[434,1345,1065],{},[434,1347,1348],{"class":436,"line":772},[434,1349,993],{"emptyLinePlaceholder":992},[434,1351,1352],{"class":436,"line":778},[434,1353,1354],{},"    public void setFullName(String fullName) {\n",[434,1356,1357],{"class":436,"line":783},[434,1358,1359],{},"        this.fullName = fullName;\n",[434,1361,1362],{"class":436,"line":788},[434,1363,1065],{},[434,1365,1366],{"class":436,"line":793},[434,1367,993],{"emptyLinePlaceholder":992},[434,1369,1370],{"class":436,"line":799},[434,1371,1372],{},"    public String getName() {\n",[434,1374,1375],{"class":436,"line":805},[434,1376,1377],{},"        return name;\n",[434,1379,1380],{"class":436,"line":810},[434,1381,1065],{},[434,1383,1384],{"class":436,"line":815},[434,1385,993],{"emptyLinePlaceholder":992},[434,1387,1388],{"class":436,"line":820},[434,1389,1390],{},"    public void setName(String name) {\n",[434,1392,1393],{"class":436,"line":826},[434,1394,1395],{},"        this.name = name;\n",[434,1397,1398],{"class":436,"line":832},[434,1399,1065],{},[434,1401,1402],{"class":436,"line":837},[434,1403,993],{"emptyLinePlaceholder":992},[434,1405,1406],{"class":436,"line":842},[434,1407,1408],{},"    public Long getUserId() {\n",[434,1410,1411],{"class":436,"line":848},[434,1412,1413],{},"        return userId;\n",[434,1415,1416],{"class":436,"line":854},[434,1417,1065],{},[434,1419,1420],{"class":436,"line":860},[434,1421,993],{"emptyLinePlaceholder":992},[434,1423,1424],{"class":436,"line":865},[434,1425,1426],{},"    public void setUserId(Long userId) {\n",[434,1428,1429],{"class":436,"line":870},[434,1430,1431],{},"        this.userId = userId;\n",[434,1433,1434],{"class":436,"line":876},[434,1435,1065],{},[434,1437,1438],{"class":436,"line":882},[434,1439,993],{"emptyLinePlaceholder":992},[434,1441,1442],{"class":436,"line":888},[434,1443,1444],{},"    @Override\n",[434,1446,1447],{"class":436,"line":893},[434,1448,1449],{},"    public String toString() {\n",[434,1451,1452],{"class":436,"line":898},[434,1453,1454],{},"        return \"UserData{\" + \"userId=\" + userId + \", name=\" + name + \", fullName=\" + fullName + '}';\n",[434,1456,1457],{"class":436,"line":903},[434,1458,1065],{},[434,1460,1461],{"class":436,"line":909},[434,1462,1088],{},[414,1464,1465,1466,1469],{},"Powyższa encja została oznaczona za pomocą anotacji ",[431,1467,1468],{},"@Entity",", dzięki czemu Hibernate będzie stworzononą klasę traktował jako encję.\nniektóre właściwości również posiadają anotacje i tak pole userId zostało opatrzone anotacją ID, które przekłada się na to że pole to traktowane jest jako klucz główny wraz ze strategią generowania identyfikatorów w sposób automatyczny.",[414,1471,1472,1473,1476],{},"Powyższą encję należy zarejestrować w pliku konfiguracyjnym Hibernate (",[431,1474,1475],{},"hibernate.cfg.xml","):",[424,1478,1480],{"className":574,"code":1479,"language":576,"meta":429,"style":429},"...\n    \u003Cproperty name=\"hibernate.transaction.auto_close_session\">true\u003C\u002Fproperty>\n    \u003Cmapping class=\"pl.xperios.hibernatestarter.model.UserData\"\u002F>\n  \u003C\u002Fsession-factory>\n...\n",[431,1481,1482,1487,1491,1496,1500],{"__ignoreMap":429},[434,1483,1484],{"class":436,"line":437},[434,1485,1486],{},"...\n",[434,1488,1489],{"class":436,"line":448},[434,1490,1164],{},[434,1492,1493],{"class":436,"line":462},[434,1494,1495],{},"    \u003Cmapping class=\"pl.xperios.hibernatestarter.model.UserData\"\u002F>\n",[434,1497,1498],{"class":436,"line":473},[434,1499,1169],{},[434,1501,1502],{"class":436,"line":484},[434,1503,1486],{},[414,1505,1506],{},"##Test",[414,1508,1509],{},"Mając wszystkie elementy tworzymy test, który doda parę rekordów do bazy a następnie pobierze je i wyświetli w konsoli:",[424,1511,1513],{"className":978,"code":1512,"language":980,"meta":429,"style":429},"package pl.xperios.hibernatestarter;\n\nimport java.util.List;\nimport junit.framework.Test;\nimport junit.framework.TestCase;\nimport junit.framework.TestSuite;\nimport org.hibernate.Transaction;\nimport org.hibernate.classic.Session;\nimport pl.xperios.hibernatestarter.HibernateUtil;\nimport pl.xperios.hibernatestarter.model.UserData;\n\npublic class AppTest extends TestCase {\n\n    public AppTest(String testName) {\n        super(testName);\n    }\n\n    public static Test suite() {\n        return new TestSuite(AppTest.class);\n    }\n\n    public void testApp() {\n\n        Session session = HibernateUtil.getSessionFactory().getCurrentSession();\n        Transaction transaction = session.beginTransaction();\n        UserData data = new UserData();\n        data.setFullName(\"FullName1\");\n        data.setName(\"Name1\");\n        session.save(data);\n        data = new UserData();\n        data.setFullName(\"FullName2\");\n        data.setName(\"Name3\");\n        session.save(data);\n        transaction.commit();\n\n\n        session = HibernateUtil.getSessionFactory().getCurrentSession();\n        transaction = session.beginTransaction();\n        List output = session.createCriteria(UserData.class).list();\n        System.out.println(\"Size: \" + output.size());\n        System.out.println(\"Size: \" + output);\n        transaction.commit();\n    }\n}\n",[431,1514,1515,1519,1523,1528,1533,1538,1543,1548,1553,1558,1563,1567,1572,1576,1581,1586,1590,1594,1599,1604,1608,1612,1617,1621,1626,1631,1636,1641,1646,1651,1656,1661,1666,1670,1675,1679,1683,1688,1693,1698,1703,1708,1712,1716],{"__ignoreMap":429},[434,1516,1517],{"class":436,"line":437},[434,1518,987],{},[434,1520,1521],{"class":436,"line":448},[434,1522,993],{"emptyLinePlaceholder":992},[434,1524,1525],{"class":436,"line":462},[434,1526,1527],{},"import java.util.List;\n",[434,1529,1530],{"class":436,"line":473},[434,1531,1532],{},"import junit.framework.Test;\n",[434,1534,1535],{"class":436,"line":484},[434,1536,1537],{},"import junit.framework.TestCase;\n",[434,1539,1540],{"class":436,"line":495},[434,1541,1542],{},"import junit.framework.TestSuite;\n",[434,1544,1545],{"class":436,"line":506},[434,1546,1547],{},"import org.hibernate.Transaction;\n",[434,1549,1550],{"class":436,"line":517},[434,1551,1552],{},"import org.hibernate.classic.Session;\n",[434,1554,1555],{"class":436,"line":528},[434,1556,1557],{},"import pl.xperios.hibernatestarter.HibernateUtil;\n",[434,1559,1560],{"class":436,"line":550},[434,1561,1562],{},"import pl.xperios.hibernatestarter.model.UserData;\n",[434,1564,1565],{"class":436,"line":630},[434,1566,993],{"emptyLinePlaceholder":992},[434,1568,1569],{"class":436,"line":636},[434,1570,1571],{},"public class AppTest extends TestCase {\n",[434,1573,1574],{"class":436,"line":642},[434,1575,993],{"emptyLinePlaceholder":992},[434,1577,1578],{"class":436,"line":648},[434,1579,1580],{},"    public AppTest(String testName) {\n",[434,1582,1583],{"class":436,"line":654},[434,1584,1585],{},"        super(testName);\n",[434,1587,1588],{"class":436,"line":659},[434,1589,1065],{},[434,1591,1592],{"class":436,"line":750},[434,1593,993],{"emptyLinePlaceholder":992},[434,1595,1596],{"class":436,"line":755},[434,1597,1598],{},"    public static Test suite() {\n",[434,1600,1601],{"class":436,"line":760},[434,1602,1603],{},"        return new TestSuite(AppTest.class);\n",[434,1605,1606],{"class":436,"line":766},[434,1607,1065],{},[434,1609,1610],{"class":436,"line":772},[434,1611,993],{"emptyLinePlaceholder":992},[434,1613,1614],{"class":436,"line":778},[434,1615,1616],{},"    public void testApp() {\n",[434,1618,1619],{"class":436,"line":783},[434,1620,993],{"emptyLinePlaceholder":992},[434,1622,1623],{"class":436,"line":788},[434,1624,1625],{},"        Session session = HibernateUtil.getSessionFactory().getCurrentSession();\n",[434,1627,1628],{"class":436,"line":793},[434,1629,1630],{},"        Transaction transaction = session.beginTransaction();\n",[434,1632,1633],{"class":436,"line":799},[434,1634,1635],{},"        UserData data = new UserData();\n",[434,1637,1638],{"class":436,"line":805},[434,1639,1640],{},"        data.setFullName(\"FullName1\");\n",[434,1642,1643],{"class":436,"line":810},[434,1644,1645],{},"        data.setName(\"Name1\");\n",[434,1647,1648],{"class":436,"line":815},[434,1649,1650],{},"        session.save(data);\n",[434,1652,1653],{"class":436,"line":820},[434,1654,1655],{},"        data = new UserData();\n",[434,1657,1658],{"class":436,"line":826},[434,1659,1660],{},"        data.setFullName(\"FullName2\");\n",[434,1662,1663],{"class":436,"line":832},[434,1664,1665],{},"        data.setName(\"Name3\");\n",[434,1667,1668],{"class":436,"line":837},[434,1669,1650],{},[434,1671,1672],{"class":436,"line":842},[434,1673,1674],{},"        transaction.commit();\n",[434,1676,1677],{"class":436,"line":848},[434,1678,993],{"emptyLinePlaceholder":992},[434,1680,1681],{"class":436,"line":854},[434,1682,993],{"emptyLinePlaceholder":992},[434,1684,1685],{"class":436,"line":860},[434,1686,1687],{},"        session = HibernateUtil.getSessionFactory().getCurrentSession();\n",[434,1689,1690],{"class":436,"line":865},[434,1691,1692],{},"        transaction = session.beginTransaction();\n",[434,1694,1695],{"class":436,"line":870},[434,1696,1697],{},"        List output = session.createCriteria(UserData.class).list();\n",[434,1699,1700],{"class":436,"line":876},[434,1701,1702],{},"        System.out.println(\"Size: \" + output.size());\n",[434,1704,1705],{"class":436,"line":882},[434,1706,1707],{},"        System.out.println(\"Size: \" + output);\n",[434,1709,1710],{"class":436,"line":888},[434,1711,1674],{},[434,1713,1714],{"class":436,"line":893},[434,1715,1065],{},[434,1717,1718],{"class":436,"line":898},[434,1719,1088],{},[414,1721,1722],{},"W konsoli powinno zostać wyświetlony następujący wynik:",[424,1724,1726],{"className":426,"code":1725,"language":428,"meta":429,"style":429},"Hibernate: insert into UserData (fullName, name, userId) values (?, ?, ?)\nHibernate: insert into UserData (fullName, name, userId) values (?, ?, ?)\nHibernate: select this_.userId as userId0_0_, this_.fullName as fullName0_0_, this_.name as name0_0_ from UserData this_\nSize: 2\nSize: [UserData{userId=1, name=Name1, fullName=FullName1}, UserData{userId=2, name=Name3, fullName=FullName2}]\n",[431,1727,1728,1769,1799,1839,1848],{"__ignoreMap":429},[434,1729,1730,1733,1736,1739,1742,1745,1748,1751,1754,1757,1760,1762,1764,1766],{"class":436,"line":437},[434,1731,1732],{"class":440},"Hibernate:",[434,1734,1735],{"class":444}," insert",[434,1737,1738],{"class":444}," into",[434,1740,1741],{"class":444}," UserData",[434,1743,1744],{"class":451}," (fullName, ",[434,1746,1747],{"class":444},"name,",[434,1749,1750],{"class":444}," userId",[434,1752,1753],{"class":451},") values (",[434,1755,1756],{"class":455},"?",[434,1758,1759],{"class":451},", ",[434,1761,1756],{"class":455},[434,1763,1759],{"class":451},[434,1765,1756],{"class":455},[434,1767,1768],{"class":451},")\n",[434,1770,1771,1773,1775,1777,1779,1781,1783,1785,1787,1789,1791,1793,1795,1797],{"class":436,"line":448},[434,1772,1732],{"class":440},[434,1774,1735],{"class":444},[434,1776,1738],{"class":444},[434,1778,1741],{"class":444},[434,1780,1744],{"class":451},[434,1782,1747],{"class":444},[434,1784,1750],{"class":444},[434,1786,1753],{"class":451},[434,1788,1756],{"class":455},[434,1790,1759],{"class":451},[434,1792,1756],{"class":455},[434,1794,1759],{"class":451},[434,1796,1756],{"class":455},[434,1798,1768],{"class":451},[434,1800,1801,1803,1806,1809,1812,1815,1818,1820,1823,1826,1828,1831,1834,1836],{"class":436,"line":462},[434,1802,1732],{"class":440},[434,1804,1805],{"class":444}," select",[434,1807,1808],{"class":444}," this_.userId",[434,1810,1811],{"class":444}," as",[434,1813,1814],{"class":444}," userId0_0_,",[434,1816,1817],{"class":444}," this_.fullName",[434,1819,1811],{"class":444},[434,1821,1822],{"class":444}," fullName0_0_,",[434,1824,1825],{"class":444}," this_.name",[434,1827,1811],{"class":444},[434,1829,1830],{"class":444}," name0_0_",[434,1832,1833],{"class":444}," from",[434,1835,1741],{"class":444},[434,1837,1838],{"class":444}," this_\n",[434,1840,1841,1844],{"class":436,"line":473},[434,1842,1843],{"class":440},"Size:",[434,1845,1847],{"class":1846},"sbssI"," 2\n",[434,1849,1850,1852,1855,1857,1860,1863,1865,1868,1871,1873,1876,1879,1881,1884,1886,1888,1891,1893,1895,1898],{"class":436,"line":484},[434,1851,1843],{"class":440},[434,1853,1854],{"class":451}," [UserData{userId",[434,1856,456],{"class":455},[434,1858,1859],{"class":444},"1,",[434,1861,1862],{"class":451}," name",[434,1864,456],{"class":455},[434,1866,1867],{"class":444},"Name1,",[434,1869,1870],{"class":451}," fullName",[434,1872,456],{"class":455},[434,1874,1875],{"class":444},"FullName1",[434,1877,1878],{"class":451},"}, UserData{userId",[434,1880,456],{"class":455},[434,1882,1883],{"class":444},"2,",[434,1885,1862],{"class":451},[434,1887,456],{"class":455},[434,1889,1890],{"class":444},"Name3,",[434,1892,1870],{"class":451},[434,1894,456],{"class":455},[434,1896,1897],{"class":444},"FullName2",[434,1899,1900],{"class":451},"}]\n",[1902,1903,1904],"style",{},"html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}",{"title":429,"searchDepth":448,"depth":448,"links":1906},[],"2012-02-02","Prezentacja Hibernate jako narzędzia do utrwalania danych","md",{"layout":1911},"post","\u002Fblog\u002F2012-02-02-fast-track-to-hibernate",{"title":408,"description":1908},"2.blog\u002F2012-02-02-fast-track-to-hibernate","ymeVyItqF8QaFR8WBBRnEXTxSEngvHuDW5_9K1bsDxY",[1917,1922],{"title":1918,"path":1919,"stem":1920,"description":1921,"children":-1},"Jetty - poręczny serwerek","\u002Fblog\u002F2011-12-15-introduction-to-jetty","2.blog\u002F2011-12-15-introduction-to-jetty","Jetty jako narzędzie ułatwiające życie programistom Java",{"title":1923,"path":1924,"stem":1925,"description":1926,"children":-1},"Aktualizacja web.xml dla Netbeans","\u002Fblog\u002F2012-02-04-update-web-xml-for-netbeans-workflow","2.blog\u002F2012-02-04-update-web-xml-for-netbeans-workflow","Wprowadzenie zmian w deskrypotrze wdrożenia w celu wyeliminowania błędów w Netbeans",1788257054524]