我收到此错误:
IWAB0398E从Java生成WSDL时出错:尝试编写重复的架构元素:{http://service.fussa.com} update
IWAB0398E从Java生成WSDL时出错:尝试编写重复的架构元素:{http://service.fussa.com}更新 AxisFault faultCode:{http://xml.apache.org/axis/} Server.generalException faultSubcode: faultString:尝试写入重复的架构元素:{http://service.fussa.com}更新 faultActor: faultNode: faultDetail: {http://xml.apache.org/axis/} stackTrace:尝试编写重复的架构元素:{http://service.fussa.com} update
我的班级:
public class SmartphoneService implements IDao<Smartphone> {
private static final String JPQL_SELECT_PAR_ID = "SELECT u FROM Smartphone u WHERE u.idSmartphone=:id";
// Injection du manager, qui s'occupe de la connexion avec la BDD
private EntityManagerFactory emf;
private EntityManager em;
public SmartphoneService() {
emf = Persistence.createEntityManagerFactory("manager1");
em = emf.createEntityManager();
}
// Enregistrement d'un nouvelle smartphone
public boolean create( Smartphone smart) {
try {
em.getTransaction().begin();
em.persist(smart);
em.getTransaction().commit();
return true;
} catch (Exception e) {
if (em.getTransaction() != null) {
em.getTransaction().rollback();
}
} finally {
em.close();
emf.close();
}
return false;
}
// Recherche d'une smartphone à partir de son id
public Smartphone findById(int id) {
Smartphone smart = null;
try {
smart = em.find(Smartphone.class, id);
return smart;
} catch (Exception e) {
if (em.getTransaction() != null) {
em.getTransaction().rollback();
}
} finally {
em.close();
emf.close();
}
return smart;
}
// MAJ d'une smartphone
public boolean update(Smartphone smart) {
try {
em.merge(smart);
em.getTransaction().commit();
return true;
} catch (Exception e) {
if (em.getTransaction() != null) {
em.getTransaction().rollback();
}
} finally {
em.close();
emf.close();
}
return false;
}
// supprimer une smartphone
public boolean delete(Smartphone smart) {
try {
Smartphone smartphone = findById(smart.getIdSmartphone());
if (smartphone != null) {
em.remove(smartphone);
em.getTransaction().commit();
return true;
}
} catch (Exception e) {
if (em.getTransaction() != null) {
em.getTransaction().rollback();
}
} finally {
em.close();
emf.close();
}
return false;
}
// findALL
public List<Smartphone> findAll() {
List<Smartphone> smarts = null;
try {
Query query = em.createQuery("SELECT e FROM Smartphone e");
smarts = (List<Smartphone>) query.getResultList();
return smarts;
} catch (Exception e) {
if (em.getTransaction() != null) {
em.getTransaction().rollback();
}
} finally {
em.close();
emf.close();
}
return smarts;
}
// Recherche d'un utilisateur à partir de son id
public Smartphone findById2(int id) {
Smartphone smart = null;
Query requete = em.createQuery(JPQL_SELECT_PAR_ID);
requete.setParameter("id", id);
try {
smart = (Smartphone) requete.getSingleResult();
} catch (NoResultException e) {
return null;
}
return smart;
}
}
感谢您的帮助