1 7 package org.objectweb.speedo.pobjects.inheritance.ejboo2; 8 9 10 import java.util.Collection ; 11 import java.util.HashSet ; 12 13 import javax.jdo.JDOHelper; 14 import javax.jdo.PersistenceManager; 15 16 17 20 21 public class CataloguePersistantImpl implements CataloguePersistant { 22 23 private Long id; 24 25 private String nom; 26 27 private String description; 28 29 33 public CataloguePersistantImpl() { 34 this.articles = new HashSet (); 35 } 36 37 public CataloguePersistantImpl(long idcat) { 38 this(); 39 id = new Long (idcat); 40 } 41 42 45 private Collection articles; 46 49 public Collection getArticles() { 50 return articles; 51 } 52 55 public void setArticles(Collection articles) { 56 this.articles = articles; 57 } 58 61 public String getDescription() { 62 return description; 63 } 64 67 public void setDescription(String description) { 68 this.description = description; 69 } 70 73 public Long getId() { 74 return id; 75 } 76 79 public void setId(Long id) { 80 this.id = id; 81 } 82 85 public String getNom() { 86 return nom; 87 } 88 91 public void setNom(String nom) { 92 this.nom = nom; 93 } 94 95 public void supprimer() { 96 System.out.println("CataloguePersistantImpl.supprimer"); 97 PersistenceManager pm = JDOHelper.getPersistenceManager(this); 98 99 System.out.println("pm.deletePersistentAll(articles)"); 100 pm.deletePersistentAll(articles); 102 103 articles.clear(); 105 106 System.out.println("pm.deletePersistent(this)"); 107 pm.deletePersistent(this); 108 109 } 110 111 112 public String toString() { 113 String s = new String (this.getClass().getName()); 114 s += " id="+id; 115 s += " nom="+nom; 116 s += " description="+description; 117 return s; 118 } 119 } 120 | Popular Tags |