0% found this document useful (0 votes)
13 views25 pages

JFSD WorkBook

The document outlines the implementation of Hibernate CRUD operations within a Maven project, emphasizing the use of Hibernate Query Language (HQL) and Criteria Query Language (CQL). It details prerequisites, advantages of Hibernate, and provides code examples for creating and managing database entities. Additionally, it discusses inheritance mapping strategies in Hibernate, specifically focusing on table per class hierarchy and subclass hierarchy for storing data.

Uploaded by

devilking810923
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
13 views25 pages

JFSD WorkBook

The document outlines the implementation of Hibernate CRUD operations within a Maven project, emphasizing the use of Hibernate Query Language (HQL) and Criteria Query Language (CQL). It details prerequisites, advantages of Hibernate, and provides code examples for creating and managing database entities. Additionally, it discusses inheritance mapping strategies in Hibernate, specifically focusing on table per class hierarchy and subclass hierarchy for storing data.

Uploaded by

devilking810923
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 25
Ta 2 Pies aiepe Le cuperiewere Tite: (WA) Hibernate CRUP Operations » HOL pimydbiective go dreate a maven project and to IMplerient the ‘hibernate ClO operatic sjehasee oe HAL ant COR Deseription: Hibernate “Me anaiities: aPitordatabare sperston ard thaw! insect for wetting query accerdine * the APL see Hol —Hibernate Avery tangvage. pet - Hibernate Criteria Cuery Lanruage Pre Reguinitess e gagt Koowiedee on Hibernate «apie Rnowledgé on Hubernate HOL and MEG FAP” ) Het (Hiberoate Query language Libevnate Gueny Language fe garne AL SOL pot aeesn’e depends an te take! of the Jrttcad of table name, We ure Clast datahate, ) el. So fe fe databace fin dependert name To Hi quer (OGRE ES povantage® oF Hat: =heve ove rmmeang advantage + at HEL -\ dotabate fodeperdent =) Suppoves potymevphre quevtes Easy do (ean for FAVA programe, Eocomple_OF HOL to get all the veeonds: Qoeny goed e fo cefoncveateMoany un erp! Chee (Fet- query. tft); . T pal 4 — J6S0-+ Micravervices. Date { Stesont tame t procedura/Progrm: GtUderst «java t public Glas¢ Shident private fant Snes private Sting Shar e: private Sting Sgondey; private Shing Seleparvtment, private lor g Seontactm umber; private [nt Spoor backlogs publfa FRE getSnog 4 vetorn Snes y publfe Verd ft Soo lint eno) Sno = Poy 4 public String getSmame( | avetern Shame s oF pebltc votd etSname (Sting Sram «) Brame = Srane- y Were | putlfe SFr. 7 a o get fgendeys ) © seen Sicrdey y or wi oa “Ord fet Sgenaicy CStiing Sender) g Sgendev= sgercey, yy peblte Siting Oct Sdepavtmenkt ) f vehno Sale paytnent. a | . poblfe vofd Set Sdlepaytment [Ging Scepartment) Sdepay tert < Sle pay treet: ¥ peblie long get Scontact nurnbey¢ } veturn Seorrtactnwmn beys Y putt. wold Set Suoptaatoumbe (tong Storberct Par Sumtactrombey = Stomtactnurcher, ay 5 publ int getnoof backtloget 3 % vehrn Snodr fac ktoas; ‘Course Tine | PABL 3 —JFSO0 + Microservices | | : Cates srt Presasita publ vod Setnuct backiege (fot sr OOF teva ds loray oF o SreoF tea elttag x = Snoofbacktog wl siheria APT 8 ifference between named ipaeiniteter ame! posibory patient 4 Ageattages of (101 Tove Hitmen sibiper anee CL Ces? ji finals ORAS bres ive ameeve exampping lv Golan sists? 1 Whit ere the atuantagng of nibarnates owes JECT B Windt iA Baty Rerariong fibers P What ure the cate components of Hibernate? 76, whet are differen: mathods-te be parormed uting Periatence Object? Arawets | rant HPbereate query fengeage Pe Came at Sy but t+ decent depends on the tabel OF +Hhe datahare, apne The avfteto Rel fe aveative povided _ by Hibernate a pepolay fava-~bared ORM framecovk. The APL allow. yeu to ; qreate queries progvarnmna taal, uriogg 7 4ype- fale OMd object-orkrted arproach, | ane postBorm pawametey! | Tk yefert to place holdere fr -the quev, | 4pot ave lent hea by fhely por?en fh | the query Sting. | flameoa povameter, Fi Th veFexe to place holders tele ures. thet ave foentted by oh bn Ge hamme., Yani I) Bakabare fn dependen ge 2+ Suppoves poly mor pbre quevtes 3: Cary te tearn for Java P09 vormner, Course Tite PBL 3 —JFSD + Mitroservices [_-ReADEHaE HEAR 2003-24 ; Course Comes) | sinaanan — : Yet, Hthevrate doce Sepport native crn iy i 5 © ' quesfes Al native Sel query mq ¢q) Sy * FY in 9 49 quevy that Pe uoriter (9 the mative Stop i f ou re Gigtect OF We databate you are vais bthavnate allows you to exccote nate Set quevfes tow cituabont where Yoo n, move carhal eversthe querty Shc hove a Performance eptinizaten thatave pop catty 4 Chey able etlng Hpe. Pangs- 6 a eEM sears for object — Petatong| PPIng. Te fe a Progwanns, te Ghné and @ Software estan one ne is CYP Hy, YOU TS map EGPRoave obcert (f, fed Govr application code ta tea 2 bh databa +c. SS are clad ong) FAPE- Dduantager pe Pibevantes vey Can 5 iC Abshaeton of Dataha ce De tafle 2- Obfect -Relatfong} Mapping 3 Porodverory Ond EFPintp. mee we a8 few GRU Opeva Fone = ARLE Tred, f §pendence 6 Aivtomate So) ase + Cachir on mt at E Butlent Maré garni Leay toadiing:— aw Hibevoate Suppevte fea Ipect i, beter you fete ~welated data ienuy uber Pt fr actoalty needed, Thre gan Troprove perfor, by reducing the amocht GF data Vetve~ca/ fon the databorc. qpnt: Cove Component of Hbevnate: = Setehon Factory “i Jvornrachon: = Sexsfan > feerty Langvare 3 fan fyurabon = Ovlterfa pz Biss Mapping roctadata, =s Caching, the Carona> prethodr that cap be pant ° performed uring perctetence phfeatr im jibevncte. 3S Create = Llebeneve and Callback — Read > Batch procerchs + Update : Iva ntac Hon. + Pelete > Mapping Pelattonehs, £ (Pte - Search =) Caching wf tary loading | Evaluator Remark (it Any): ] Morks Secured: _ out of SO Signature of the Evaluator with Date ee Evaluator MUST ask Vive-voce prior ta signing and posting marks for each experiment. [Gees tela a oe Ekreciviert Title: Hibernate Intimettanhine BAaprin - Tatsle pe teieranttey riet Guts Cae sarap ‘To vertabban he iberlinnee seth Hibernate ower Whe witty ttnnaet tre Tat peer ‘aft pve lees recor ‘Description Hibernane Table tr Hierarchy one tatanate rattle will bee creamed fine eernerctay of etka sevtry end tte Witpermarte Table ef Sui Cheah ~ Cd database tale ol ee trate! for etacts Ba hats Pre Fergaiinlbes: = Kmawbndge ost Hehernates + Rnwwiecige on OQ), ana HCO 20 parton CRUE! Operatian uge cap hap the Sohexttance Pfevarchy lore, atobere-Thavre are he ol ch dhe table oF — < fnhevttance mapping strategt=< defhed é 8 br bemabe j- Table Fev Hieyarehey 2 Table Per Cop arvete. Clarr 3. Table pevy Gubclact . {Table per Hievarohyi | tp toble per flexavabyy ts vequired! po map the whole ; mo fe added to fdent hy +he ave Stovea! tn He rapping Sng lc table hierarchy yan etre col clare Bet nullable Ualoee drable | Afable per Htevave by we lng xent Bie abie per bltevarehy Using PAnobation Ugnurie tiie Toni wo Wei taieencorimra ary in-tab 1. Affank Customer wants 19 try Inheritance through Table per class Hierarchy, so he ereated a base Slass named Payinent, containing attributes like payman, amount ard tie derived classes namely Credit Card consisting of type of Credit Card they Used and Cheque containi type of chemurr. So, when the object of derived class i¢ saved, objert of base class will also get stored in the database in single table. To know the Object af which class 1s stored we must use the Discriminator colutnn. Apply Concept of Table per Class Hierarchy through Hibernate Framework From the Bank-Payment Scenarie use the concept of table per subclass Hierarchy wing Hibernate FrameWorkand observe bow it works and storing data in di Payer jaw. pub i= clase Payment z publfe frit payment; poblfc tht amount: peble int getpaymenty 5 vetuye payment; poblfe void fetPoyment CPt payment ) t Hh Fepayment = Paget y pebl’c Prt getArovurst ¢) yetuvr amount; ee peblfe votd get Areoent Cire aeaparne) ftnte-arooontsamount; [Course Title | PBL3—JFSD 4 Microservices: [ACADEMIC vem ee [Course Codels) | aitssioan | Page atofse: [ate Procedure/ Program: Credicteard. favat- publre élate Crediteqvg enctende Payment e rs) public rate Sq laviys publtc fnt acbfalariye ) z wet Ea lay Oy pebltc vor Set falavy Crt Colary) this: galany = Salary; , poblfe Sting toS-bfn gO F velo Cred cay Esalery. = catavey a] 4 Std GF Y Data and Rosults: Main tovas publ Fe clare Mlaln os public Stabe vol mal (Sting Divas) r a GercinnFactoy sescfonfactory = new tan fravrattany Conger (> batid Gextlon Factory (), terefom Sector = fe efonFattor gy: pan eecs tant a Trantactiae +; ee recston. begin ran eee amee zi Creadtboawd crn GrecPtearctt )- Ce cet Payment fre); eee Amount Cieoa). oteb Satay Cinco); Cheque ehqnee Cheque e oh- tet Payment Coa); ch-cet Prout 2000} eh at cet Payment liane). éeerone ave (2): estrone Lave fohoy y #- com mPhtd; [Course Tile | PBL3—JFSD-= Microservices "ACADEMIC YEAR; 2023-24 | [Course Code(s] _| sirsa0an Page 13 of 97

You might also like