2. create a people class, which is equivalent to a javabeanpackage COM. example. bean; public class people {private int ID; private string name; private string status; Public int GETID () {return ID;} public void setid (int id) {This. id = ID;} Public String getname () {return name;} public void setname (string name) {This. name = Name;} Public String getstatus () {return status;} public void setstatus (string status) {This. status = status ;}}3. Create the people. HBM. xml file in the src directory to map to the people table in the database. <? XML version = "1.0" encoding = "UTF-8"?> <! Doctype hibernate-mapping public "-// hibernate/hibernate DTD ing DTD 3.0 // en" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> 4. Create the hibernate. cfg. xml file in the src directory to connect to the database. <? XML version = "1.0" encoding = "UTF-8"?> <! Doctype hibernate-configuration public "-// hibernate/hibernate configuration DTD/EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> 5. create a help class to create and delete sessions, and get the session factory package COM. example. util; import Org. hibernate. hibernateexception; import Org. hibernate. session; import Org. hibernate. sessionfactory; import Org. hibernate. cfg. configuration; public class dbutil {Private Static final sessionfactory; @ suppresswarnings ("unchecked") public static final threadlocal session = new threadlocal (); static {sessionfactory = new configuration (). con Figure (). buildsessionfactory () ;}@ suppresswarnings ("unchecked") public static session currentsession () throws hibernateexception {session S = (Session) session. get (); If (S = NULL |! S. isopen () {S = sessionfactory. opensession (); Session. set (s);} return s;} public static void closesession () throws hibernateexception {session S = (Session) session. get (); Session. set (null); If (s! = NULL) S. Close ();} public sessionfactory getsessionfactory () {return sessionfactory ;}}