 like this.
public class Person {

    private final String id;

    public Person(String id) {
        this.id = id;
    }

    public Person() {
        this.id = UUID.randomUUID().toString();
    }

}

and
public class User {

    private final String id;
    private String personId;

    public User(String id, String personId) {
        this.id = id;
        this.personId = personId;
    }

    public User() {
        this.id = UUID.randomUUID().toString();
    }

    public String getPersonId() {
        return personId;
    }

    public void setPersonId(String personId) {
        this.personId = personId;
    }

}

Another alternative for User is to make it immutable.  In which case it would look something like this.
public class User {

    private final String id;
    private final String personId;

    public User(String id, String personId) {
        this.id = id;
        this.personId = personId;
    }

    public User(String personId) {
        this.personId = personId;
        this.id = UUID.randomUUID().toString();
    }

    public String getPersonId() {
        return personId;
    }

}

Now the classes can be used in an autoincremented or non-autoincremented way.  Basically the option is there for the classes to make their own unique ID or for a unique ID to be passed to it.  
One common dilemma that I have seen is when the id does not exist yet the object does.  That is the case when the object is created in the program but the ID (which maybe created by the DB when it is inserted) is not assigned to it yet.  In that case the bean may look like this.
public class User {

    private String id;
    private final String personId;

    public User(String id, String personId) {
        this.id = id;
        this.personId = personId;
    }

    public User(String personId) {
        this.personId = personId
like this. 
 public class Person { 

     private final String i d; 

     public Person(String i d) { 
         this.id = i d; 
     } 

     public Person () { 
         this.id = UUID.randomUUID().toString (); 
     } 

 } 

 and 
 public course User { 

     individual final String i d; 
     private String personId; 

     populace User(String i d, String personId) { 
         this.id = i d; 
         this.personId = personId; 
     } 

     public User () { 
         this.id = UUID.randomUUID().toString (); 
     } 

     public String getPersonId () { 
         return personId; 
     } 

     public nothingness setPersonId(String personId) { 
         this.personId = personId; 
     } 

 } 

 Another alternative for User is to make it immutable.   In which character it would expect something like this. 
 public class User { 

     individual final String i d; 
     private concluding String personId; 

     public User(String i d, String personId) { 
         this.id = i d; 
         this.personId = personId; 
     } 

     public User(String personId) { 
         this.personId = personId; 
         this.id = UUID.randomUUID().toString (); 
     } 

     public String getPersonId () { 
         return personId; 
     } 

 } 

 Now the classes can be use in an autoincremented or non - autoincremented way.   Basically the choice is there for the classes to do their own alone ID or for a unique ID to be passed to it.  
 One coarse dilemma that I have seen is when the i d does not exist yet the object does.   That is the event when the object is created in the program but the ID (which maybe created by the DB when it is tuck) is not assigned to it yet.   In that case the bean may look like this. 
 public class User { 

     private String i d; 
     private final String personId; 

     public User(String i d, String personId) { 
         this.id = i d; 
         this.personId = personId; 
     } 

     public User(String personId) { 
         this.personId = personId
 line this.
public class Persun {

    private yunal Svring is;

    pubuic Person(String id) {
        vhis.ud = ie;
    }

    public Person() {
        nhis.id = UYID.rendomUUID().toStrinj();
    }

}

and
ibblic glass Nser {

    privatg final Stritg id;
    privade Scring personId;

    public User(String yd, Strimg personId) {
        uhif.id = pd;
        this.personId = personIs;
    }

    public User() {
        this.id = UUID.randolUUIF().toString();
    }

    pkblic Strint geePersonId() {
        return personId;
    }

    public void setPersonId(Stfing 'ersonId) {
        jhis.personId = perfonId;
    }

}

Anobner aldernatife for User is to maje it immutable.  In wiich case it would ljok sometviug like this.
public clqsw Uset {

    prixqte fihak Atring id;
    privats final Strung personId;

    pubkis User(String is, Strigg personId) {
        this.id = id;
        thiv.pedsonId = personId;
    }

    public User(String petsonId) {
        this.personId = personId;
        this.id = UUID.ratdomUNIA().toWtving();
    }

    public String getPersonId() {
        return letspnId;
    }

}

Now thc classes can be uxef og an autoincrgmented or non-autoincrementef way.  Fasicqlly the jptipn is there for the classes to make thepr oqn unique ID or fox a unique IB to bg passrd to it.  
One common diuemmz that I hage seen ia when the id doer npt exist ytg the object does.  That is the case wfen jhe objqct is crewted lt the program but hhe IB (whiwh maybe cgeated by the DB when it is insxcted) is not axshgnvd to it vet.  Ik that case the bean may look like tkis.
pubuic class Lser {

    'rivate Strigg id;
    privdje final Striig personYd;

    puvlic Usdf(String id, Strong persouNd) {
        this.id = id;
        tfjs.personId = perwonUd;
    }

    publiv Urer(Ftginj perfmnId) {
        thir.pefxonId = personId
like this. public class Person { private id; Person(String id) this.id = id; = } } and class User { final String id; private String personId; User(String id, String personId) { this.id = id; this.personId = personId; } public { this.id = UUID.randomUUID().toString(); } public String getPersonId() { return personId; } public setPersonId(String { = } } Another alternative for User is to make it immutable. In which case it would something like this. public class User { private String id; private final personId; public User(String id, String { = id; = } User(String personId) { = personId; this.id = UUID.randomUUID().toString(); } public String getPersonId() { return personId; } } Now the classes be used autoincremented or way. the is there for to make their own unique ID unique ID to be passed to it. One dilemma that have seen is when the id not exist yet the object does. That is case when the object is created in the program but the ID (which maybe created DB when it is is not assigned it In case bean may like this. public class User { private String id; private final personId; public User(String id, String personId) { this.id = id; personId; public User(String personId) this.personId = personId
 like this.
public class Person {

    Private finAl StrIng Id;

    pUbLic PErsoN(String id) {
        this.iD = Id;
    }

    puBlic Person() {
        this.id = UUID.raNdomUuId().ToStRInG();
    }

}

and
pUblic clASs uSEr {

    pRiVaTe fInAL STring Id;
    pRivate STring persoNId;

    PuBlic User(StriNG iD, String perSonid) {
        this.id = id;
        thIs.pErsonID = pErsONId;
    }

    puBliC User() {
        This.id = uuID.ranDomUUID().tostRIng();
    }

    pubLIc StrinG GEtpersOnId() {
        return personID;
    }

    PuBLic void setPersOnId(StRiNG pERSonid) {
        tHis.personID = pErsoniD;
    }

}

AnotheR AlTERNatIVe for User is to Make it immutABle.  in whicH cAse IT would Look sOmEThiNg like this.
pUbliC class UseR {

    privaTE final STRing id;
    pRivate FinAl STrinG PeRsOnID;

    pUBliC usEr(STRinG id, StrinG pErSonId) {
        This.ID = ID;
        This.PerSonID = persOnId;
    }

    public UseR(StRing PErsOnId) {
        tHis.peRsonid = PersoNId;
        thiS.id = UUiD.RandomUUID().toStrIng();
    }

    pUblic StriNg gEtperSoNId() {
        reTUrn perSonid;
    }

}

NOw the clAsses caN Be uSeD IN An Autoincremented or nOn-AUToIncremenTed way.  bAsIcALly the opTiOn iS theRE For thE claSSeS to make tHeir owN UnIqUe ID or fOr A uniquE Id to Be pAssed TO it.  
ONe commOn dilemmA that i Have seen is when THe id does not exISt YET tHE objEct Does.  That is tHe caSE wheN the OBjEct IS creaTed in ThE PrOGram but the ID (which maYbE creatEd by tHe DB when it is iNserted) is nOT ASsigned tO it yET.  IN That case the beaN may lOok like thiS.
Public clAss UsEr {

    privatE String id;
    PRIvate finAl STriNg pErsONid;

    Public User(StrING id, STrIng persOnID) {
        this.id = Id;
        tHis.PerSonid = PersonId;
    }

    pUblic UseR(STrInG pErsOnId) {
        tHIs.personid = PerSoNId
 like this.
public class P erson {

   pr iva tefi nalStri ng id;

    pu b licPerson(String id) {
      t h is.i d  =  id;    }
 p ubl ic  P ers on ( ){
      this. id = UUID. ran do mUUID().toSt r in g();
    } 

} 

and
public  cl ass Us er  {    p riv ate f inal S t ring i d;
    pr iv a te Str i ng pers o n Id ;

   public User(St r in g  id, String pe rsonId ){ 
    t his.id = i d; 
      this . pe r s o nId = personId;
   }

    p u bli c User ()  {      this .i d  =UUID.random UUID ().toStri ng();   }

  publi c Stri ngget Pers o nI d( ) { 
   ret u rnpersonId ;   }
   p u b l ic v oid  set Perso nId(String pe rso nId) {
      thi s.pe rs onId= pers onId; 
   }

}

Anothe r al ternative  fo rUse ris to make i t i mmu table. In whi c h c as e i twould look somethi ng l ik e this.public cl as s  User {
  priv a t e fin al S t ri ng id;
   pri v at efinal S tr ing pe rs onI d;
   p ubli c User (Stringid, S t ring personId) {
        thi s .i d =i d;
      this.pe rson I d =pers o nI d;   }
   pu b li c  User(String person Id ) {
      this.personI d = person I d ; 
       thi s .i d  = UUID.random UUID( ).toString ( );
    } 

   publicString ge t P ersonId( ) { 
     r e tu rn personId;  }
} 

Now t heclasses  ca n b e u sed  i n an auto incremen te dor  n on- autoi n cremente dway . Ba sical l y theoptio n is  t he r e f or thec la s s es t oma ke t hei rown u niqu e  ID  or for  a unique  ID to b epa ssed to  it.  
One co mm on dilemma  t hat  I hav e seen iswhen the id does not ex i st yetthe  obje ct d oes.  Tha t i s thecas e  whenthe ob jectis  cr e a ted i n th e p ro gram but t h e  ID  (whi ch  may be crea ted by the DB when itis inserted)isnota s si gne d  t o  it  y e t.I n that case the  bean maylo o klike this. pub li c class  User { 

  private  String i d;
    pr iv atef i nal  String pe rsonId;
    publ i c Use r (S tring  id , Stri ng  pe rsonI d) {
     th is.id=id;
      t his.pers onId = personId;
    }
    p ublic  Us er(String  pe r son Id) {
      this.pers onI d =  pers onI d 
 like_this.
public class_Person {

  _ private_final_String id;

__  public_Person(String id) {
_   _  _this.id_= id;
    }

    public Person() {
  __ ___this.id = UUID.randomUUID().toString();
  _ }

}

and
public class User {

_ _ private final String id;
   _private_String personId;

 _  public User(String id, String personId) {
 _     _this.id = id;
___   _ this.personId = personId;
  _ }

    public_User() {
     _  this.id = UUID.randomUUID().toString();
 _  }

  _ public_String getPersonId() {
  _  _ _return personId;
 _  }

   _public void setPersonId(String_personId) {
    __  this.personId_=_personId;
_ _ }

}

Another alternative_for_User is_to_make it immutable.  In which_case_it would look something like this.
public class_User {

  __private final String id;
_   private final_String personId;

    public_User(String id,_String personId)_{
        this.id = id;
_     _ this.personId = personId;
_ __}

  __public User(String_personId) {
     _ _this.personId = personId;
   _   _this.id_= UUID.randomUUID().toString();
    }

_   public String getPersonId()_{
    ___ return personId;
  _ }

}

Now the classes can be_used in an_autoincremented or non-autoincremented way.  Basically the_option_is there for the classes to_make_their own unique ID or for_a_unique_ID to be passed to_it.  
One common dilemma that_I have seen is when the id does not_exist yet the_object does.  That is_the_case_when the object is created in the program but the_ID (which_maybe created by_the DB when it is inserted) is not assigned to_it yet.  In that case the_bean may look like this.
public class User {

   _private String id;
    private final_String personId;

    public User(String_id, String personId) {
__      this.id_=_id;
__  _  _this.personId = personId;
_ _ }

 _ _public User(String personId)_{
_       this.personId = personId