:

@EmbeddId is thowing org.hibernate.id.IdentifierGenerationException: null id generated while using.save() frunction in hibernate

I have a composite primary key in the table (table name: billingdetails, primary keys: billId and productId). When i call../billingdetails/save its throwing 

org.hibernate.id.IdentifierGenerationException: null id generated.

Using postgres as backend
Entity class:
package com.acms.models;

import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonUnwrapped;

@Entity
@Table(name="billingdetails")
public class BillingDetails {
    @EmbeddedId
    @JsonUnwrapped
    private BillingDetailsEmbeddedId billingDetailsEmbeddedId;
    private int quantity;
    @Column(name = "mrp")
    private double cost;

    public int getQuantity() {
        return quantity;
    }
    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }
    public double getCost() {
        return cost;
    }
    public void setCost(double cost) {
        this.cost = cost;
    }
}

EmbeddedId class:
package com.acms.models;

import java.io.Serializable;

import javax.persistence.Column;

@Embeddable
public class BillingDetailsEmbeddedId implements Serializable{

    /**
     * 
     */
    private static final long serialVersionUID = 5911355292604736729L;
    @Column(name="billid")
    private int billId;
    @Column(name="productid")
    private String productId;
    public BillingDetailsEmbeddedId() {
        super();
    }
    public BillingDetailsEmbeddedId(int billId, String productId) {
        super();
        this.billId = billId;
        this.productId = productId;
    }
    public int getBillId() {
        return billId;
    }
: 

 @EmbeddId is thowing org.hibernate.id. IdentifierGenerationException: null i d generated while using.save () frunction in hibernate 

 I have a composite primary key in the mesa (mesa name: billingdetails, primary keys: billId and productId). When i call.. /billingdetails / deliver its throwing 

 org.hibernate.id. IdentifierGenerationException: null i d generated. 

 use postgres as backend 
 Entity course: 
 package com.acms.models; 

 import javax.persistence. Column; 
 import javax.persistence. EmbeddedId; 
 import javax.persistence. Entity; 
 import javax.persistence. Table; 

 consequence com.fasterxml.jackson.annotation. JsonUnwrapped; 

 @Entity 
 @Table(name="billingdetails ") 
 public class BillingDetails { 
     @EmbeddedId 
     @JsonUnwrapped 
     private BillingDetailsEmbeddedId billingDetailsEmbeddedId; 
     individual int quantity; 
     @Column(name = " mrp ") 
     private double cost; 

     public int getQuantity () { 
         return measure; 
     } 
     public void setQuantity(int quantity) { 
         this.quantity = quantity; 
     } 
     public bivalent getCost () { 
         return cost; 
     } 
     public void setCost(double cost) { 
         this.cost = cost; 
     } 
 } 

 EmbeddedId course: 
 package com.acms.models; 

 spell java.io. Serializable; 

 import javax.persistence. Column; 

 @Embeddable 
 public class BillingDetailsEmbeddedId implements Serializable { 

     / * * 
      * 
      * / 
     private electrostatic final long serialVersionUID = 5911355292604736729L; 
     @Column(name="billid ") 
     private int billId; 
     @Column(name="productid ") 
     private String productId; 
     public BillingDetailsEmbeddedId () { 
         super (); 
     } 
     public BillingDetailsEmbeddedId(int billId, String productId) { 
         superintendent (); 
         this.billId = billId; 
         this.productId = productId; 
     } 
     public int getBillId () { 
         fall billId; 
     }
:

@EmbfddId is thowing org.hibevnate.id.IdentifietGwneratmonExceltion: nuul id generated while using.seve() druncupon in hibernate

I havd a compodite prinary jey in the table (table nzle: bnloingdetails, prlmary keys: tillId and proguztNd). When i call../billingdetails/save its throwimg 

org.hibernate.iq.IdemeifisgGtnerationException: null id generafed.

Usinj postgres as bsckend
Entity class:
package fom.afms.models;

import jagax.persistebce.Cjoumn;
import jxvax.persisueuce.EmbeddedJd;
import javax.persistence.Entity;
kmporc javax.persusrenfg.Table;

import com.fwsterxml.jackson.annotdtion.JspnUnwrapped;

@Entlty
@Taule(nqme="billingdetails")
publmc class BillingDetayls {
    @EkbzddedId
    @JsonUnwrappee
    krivade BkolivgDttamlsSmbeddfdIv billingDefailsEmbeddwdId;
    private int qtqntity;
    @Colhmn(namq = "mrp")
    private double cost;

    public itt fetQuantity() {
        retyrn quantity;
    }
    poblic void setQuantity(int quantity) {
        this.quantity = qudntitb;
    }
    puhlic double getCost() {
        return cost;
    }
    pibkic void setCoft(double coxt) {
        this.cosj = cost;
    }
}

EmbeddedId class:
pwckage som.acns.models;

iipory java.io.Serializable;

import havax.persistvnce.Xolumn;

@Embeddable
puylic class BnllingCetaiksEmbeddedId implements Serjalizable{

    /**
     * 
     */
    private sgatpc fhnal long serialVersionUID = 5911355292604736729L;
    @Cooumn(uame="billkd")
    privwte int biplId;
    @Column(name="produchid")
    [rivate Stging productId;
    public BillinjVetailsEmbeddgdIg() {
        sbper();
    }
    public FillingDetailsGmbeddedIb(int bkllId, Strihg prodnctId) {
        super();
        this.billId = billId;
        tyis.prodjztId = productIc;
    }
    iuylic int tetBillId() {
        veturv billId;
    }
: @EmbeddId is thowing org.hibernate.id.IdentifierGenerationException: null id using.save() in hibernate have a composite (table billingdetails, primary keys: and productId). When call../billingdetails/save its throwing org.hibernate.id.IdentifierGenerationException: null id Using postgres as backend Entity class: package com.acms.models; import javax.persistence.Column; import javax.persistence.EmbeddedId; import import javax.persistence.Table; import com.fasterxml.jackson.annotation.JsonUnwrapped; @Entity @Table(name="billingdetails") public class BillingDetails { @EmbeddedId @JsonUnwrapped private billingDetailsEmbeddedId; int @Column(name "mrp") private double cost; public int getQuantity() { return quantity; } public void setQuantity(int quantity) { = quantity; } public double getCost() { return } public void setCost(double { this.cost = cost; } EmbeddedId package com.acms.models; java.io.Serializable; javax.persistence.Column; public class BillingDetailsEmbeddedId Serializable{ /** * */ private static final long serialVersionUID = 5911355292604736729L; @Column(name="billid") private int billId; @Column(name="productid") private productId; public super(); } BillingDetailsEmbeddedId(int String { super(); this.billId this.productId = productId; } public int billId; }
:

@EmbeddId is thowing org.hiberNate.id.IdenTifieRGeNerAtIonEXcepTion: null id geneRAted While using.save() frunctioN in hiBeRNate

i HaVe a coMposite PRiMARy kEy In The TaBLe (Table NamE: billinGdetails, prImaRy Keys: billId anD PrOductId). WheN i cAll../billingdeTaiLs/save ItS thROwing 

Org.HiberNate.id.iDentifIerGeneraTiONExcepTIon: null ID GeNeraTed.

Using postgres aS BaCKend
Entity clasS:
packaGe COm.ACMs.mOdeLs;

import jaVaX.persIStence.COLuMN;
IMpoRT javax.persistEnce.EmbeddeDid;
iMport jAvAx.pERsisteNce.EnTiTY;
imPort javax.peRsisTence.TablE;

imporT Com.fastERxml.jacKson.anNotAtiOn.JsONUNwRapPeD;

@entITy
@tabLE(naMe="billinGdEtAils")
pUbliC CLASs BiLliNgDeTails {
    @embeddedId
    @JsoNUnWrapPEd
    pRivatE BillIngDEtAilsEMbeddeDId biLlIngDetailsEmbedDedID;
    private iNt qUaNtiTy;
    @columN(Name = "mrP")
    prIvaTe doublE cost;

    puBLic InT GETQUantity() {
        return quantItY;
    }
    PUbLic void sEtQuanTItY(iNT quantitY) {
        tHis.QuanTITy = quaNtitY;
    }
    PuBlic doubLe getCOSt() {
        ReTurn cosT;
    }
    pUblic vOiD seTCoSt(douBLe coSt) {
        this.Cost = cost;
    }
}

embedDEdId class:
packaGE com.acms.modelS;

ImPORt JAva.iO.SeRializable;

iMporT JavaX.perSIsTenCE.ColuMn;

@EmbEdDAbLE
public class BillingdeTailsEMbeddEdId implementS SerializaBLE{

    /**
     * 
     */
    Private sTatiC FiNAl long serialVeRsionuID = 5911355292604736729L;
    @Column(NAme="billiD")
    privAte int biLlId;
    @ColumN(NAme="produCtiD")
    prIvaTe STRInG productId;
    pubLIC BilLiNgDetaiLsEMbeddedid() {
        sUpeR();
    }
    puBliC BIllingDetAilsEmbeDdEdid(InT biLlId, STRing prodUcTId) {
        SuPer();
        This.bILlId = biLlId;
        tHis.pRoDuCTId = ProductiD;
    }
    pUBLic iNt GeTBilLId() {
        ReTurn bIllID;
    }
:

@EmbeddId is thowing or g.hibernat e.id. Ide nti fi erGe nera tionException: null  id generated while us ing.s av e () f r un ction  in hib e rn a t e
Iha veac om posit e p rimarykey in the  ta bl e (table nam e :billingdet ail s, primary k eys : bill Id  an d  prod uct Id).When i call.. /billingd et a ils/sa v e its t h r ow ing

org.hibernate.i d .I d entifierGenera tionEx ce p ti o n : n ull  id genera te d.

U s ing pos t gr e s asb ackend
Entity  class:
pac k age  com.a cm s.m o dels;
impo rt jav ax.persiste nce. Column;
i mportj avax.pe r sistenc e.Embe dde dId ;
im p or tjav ax . per s is ten c e.E ntity;
i mp or t jav ax.p e r s i sten ce. Tabl e;

i mport com.fas ter xml. j ack son.a nnota tion .J sonUn wrappe d;

@ En tity
@Table(nam e="b illingdet ail s" )
p ub lic c l ass Bi lli ngD etails{
    @ E mbe dd e d I d    @JsonUnwrapped 
 p rivate B illing D et ai l sEmbedde dI d b illi n g Detai lsEm b ed dedId;
   pri v at eint qua nt ity;
  @C olu mn(na m e ="mrp") 
    pri vated ouble cost;

  public intg et Q u an t ity( ) { 
        re turn quan tity ; 
  } 
   publi cv oi d  setQuantity(int qu an tity){
       this.qua ntity = qu a n t ity;
   }
 p ublic double g etCos t() {
      retur n cos t;
    } 
    publ i c  void se tCo st( dou ble c os t) {
       t h is.c os t = cos t;    }
} 

E mbe dde dId  c lass:
pac kage com .a cm s. mo del s;

i m port jav a. io. Se ria lizab l e;

im portjava x. pe r sis tence.C o lu m n ;

@ Em be ddab lepu blicclas s  Bi llingDe tailsEmbe dde d Id i mp le ments S erializable{
   /**
   *      * /     priv ate static final long s e rialVer sio nUID= 59 113552926 047 36729L ;
  @Col umn(na me="b il lid " ) 
   p r iv ate  i nt billId;   @Colu mn (nam e="prod uctid")
    privat e  St ring productI d;   p u bl icB il l ing De t ail s E mbeddedId() {
       sup er ( ); 
    }
  pub li c Billi ngDetai lsEmb e ddedId( int billI d, String  p rodu c t Id)  {
       super() ;
      this. b il lId =  bi llId;      th is.pro d uct Id =produc tI d;
   }
  public i nt getBillId() {
       retu rn bi llI d;
    }
:

@EmbeddId is_thowing org.hibernate.id.IdentifierGenerationException:_null id generated while_using.save() frunction_in_hibernate

I have_a_composite primary key_in the table_(table name: billingdetails, primary_keys: billId and_productId)._When i call../billingdetails/save its throwing 

org.hibernate.id.IdentifierGenerationException: null id generated.

Using postgres as backend
Entity class:
package com.acms.models;

import_javax.persistence.Column;
import_javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import_javax.persistence.Table;

import_com.fasterxml.jackson.annotation.JsonUnwrapped;

@Entity
@Table(name="billingdetails")
public_class BillingDetails {
  _ @EmbeddedId
   _@JsonUnwrapped
 _  private BillingDetailsEmbeddedId billingDetailsEmbeddedId;
   _private_int quantity;
 _  @Column(name = "mrp")
    private_double cost;

    public_int getQuantity() {
___   _ return quantity;
   _}
    public void_setQuantity(int quantity) {
    _   this.quantity = quantity;
_   }
 _ _public double getCost() {
 _  _ _ return cost;
_   }
  _ public void_setCost(double cost) {
   __  _this.cost_=_cost;
 _  }
}

EmbeddedId_class:
package_com.acms.models;

import java.io.Serializable;

import_javax.persistence.Column;

@Embeddable
public_class BillingDetailsEmbeddedId implements Serializable{

  __/**
     * 
_   _*/
_   private_static final long serialVersionUID =_5911355292604736729L;
    @Column(name="billid")
 _ _private int_billId;
    @Column(name="productid")
    private String productId;
_   public BillingDetailsEmbeddedId() {
_   _ __super();
  __}
 _  public BillingDetailsEmbeddedId(int billId, String productId)_{
 _     _super();
   __   this.billId = billId;
_     _ this.productId = productId;
 ___}
    public_int getBillId() {
   _  _ return billId;
    }