【发布时间】:2015-12-27 23:12:10
【问题描述】:
我收到此错误:
IWAB0398E 从 Java 生成 WSDL 时出错:尝试写入重复的模式元素:{http://service.fussa.com}更新
IWAB0398E 从 Java 生成 WSDL 时出错:尝试写入重复的模式元素:{http://service.fussa.com}更新 轴故障 故障代码:{http://xml.apache.org/axis/}Server.generalException 故障子代码: faultString:尝试写入重复的架构元素:{http://service.fussa.com}更新 故障演员: 故障节点: 故障详情: {http://xml.apache.org/axis/}stackTrace:尝试写入重复的架构元素:{http://service.fussa.com}更新
我的班级:
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;
}
}
感谢您的帮助
【问题讨论】:
标签: java eclipse web-services wsdl axis