Bonjour, Je désire utiliser une nouvelle fonctionnalité d'hibernate qui permet de faire persister un arbre xml J'ai un arbre qui contient des objets. J'arrive à faire persister l'objet principal mais pas les sous-objets. voici les différents fichiers de paramétrage: voici un extrait du fichier hbm ?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <class entity-name="InputOrder" table="inputorder" node="subscribeInput"> <id name="subscriptionid" column="subscriptionid" node="subscriptionId" type="string"/> <property name="customerid" column="customerid" node="customerId" type="string" /> <property name="commercialOfferid" column="commercialOfferid" node="commercialOfferId" type="string"/> <property name="period" column="period" node="period" type="string"/> <property name="override" column="override" node="override" type="string"/> <property name="tryAndBuy" column="tryAndBuy" node="tryAndBuy" type="string"/> <property name="tryAndBuyDuration" column="tryAndBuyDuration" node="tryAndBuyDuration" type="string"/> <many-to-one name="subSubscriptionid" entity-name="SubSubscription" column="subSubscriptionid" embed-xml="true" node="subSubscription" cascade="persist"/> <many-to-one name="serviceSubscriptionid" entity-name="ServiceSubscription" column="serviceSubscriptionid" embed-xml="true" node="serviceSubscription" cascade="persist"/> <many-to-one name="parametersid" entity-name="Parameters" column="parametersid" embed-xml="true" node="parameters" cascade="persist"/> <many-to-one name="tokenid" entity-name="Token" column="tokenid" embed-xml="true" node="token" cascade="persist"/> </class> <class entity-name="Parameters" table="params" node="parameters"> <id name="id" column="id" node="id" type="string"/> <property name="idValueCombinaison" column="idValueCombinaison" node="idValueCombinaison" type="string" /> <property name="valueid" column="valueid" node="valueid" type="string"/> <property name="valuesid" column="valuesid" node="valuesid" type="string"/> <property name="name" column="name" node="name" type="string"/> <property name="valueType" column="valueType" node="valueType" type="string"/> <property name="parameterType" column="parameterType" node="parameterType" type="string"/> <property name="prevParameter" column="prevParameter" node="prevParameter" type="string"/> <property name="nextParameter" column="nextParameter" node="nextParameter" type="string" /> <property name="visible" column="visible" node="visible" type="string" /> </class>
voici un extrait de la classe Java doc = sr.read("InputOrder.xml"); Object object = doc.selectSingleNode("//subscribeInput"); System.out.println(doc.asXML()); Session session = sessionFactory.openSession(); Session xmlSession = session.getSession(EntityMode.DOM4J); Transaction tx = session.beginTransaction(); xmlSession.saveOrUpdate("InputOrder", object); session.flush(); tx.commit(); session.close();
L'objet inputorder est mis en base mais pas l'objet parameters. Est-ce que quelqu'un aurais une idée. Merci d'avance, Pascal
|