public boolean saveCommande(List<DetailCommand> listDetailCommand,Commande commande){
EntityManager em=getEntityManager();
EntityTransaction tx= em.getTransaction();
try{
tx.begin();
DetailCommand detailCommand=new DetailCommand();
detailCommand= listDetailCommand.get(0);
commande.setFournisseur( new Fournisseur(detailCommand.getCodFourn()));
SysUsers sysUsers=new SysUsers();
sysUsers.setId(new SysUsersId(detailCommand.getCodUser(),detailCommand.getSysProduit().getSysAdherent().getIdAdherent()));
commande.setSysDate(new Date());
commande.setSysUsers(sysUsers);
this.persist(commande, em);
for(int i=0;i<listDetailCommand.size();i++){
detailCommand=new DetailCommand();
detailCommand=(DetailCommand)listDetailCommand.get(i);
detailCommand.setCommande(commande);
detailCommand.setPrixTotc(detailCommand.getPrixUnitc()*detailCommand.getQteContenant());
detailCommand.setPrixTotd(detailCommand.getPrixUnitd()*detailCommand.getQteDetail());
detailCommand.setPrixTot(detailCommand.getPrixTotc()+detailCommand.getPrixTotd());
detailCommand.setId(new DetailCommandId(commande.getIdCommand(),i));
detailCommand.setIsLivre("False");
detailCommand.setSysDate(new Date());
this.persist(detailCommand,em);
}
tx.commit();
return true;
}