-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: persistance de flux xml
PostPosted: Tue Jun 09, 2009 10:32 am 
Newbie

Joined: Tue Jun 09, 2009 10:23 am
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.