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: problème de mapping: mapper un champ sur une fonction
PostPosted: Tue Oct 31, 2006 7:26 am 
Newbie

Joined: Fri Sep 22, 2006 4:17 am
Posts: 10
Hibernate version:3.1.3

Mapping documents:
<class table="TSRFILOT" name="Ilot" lazy="false">
<id column="idIlot" name="idIlot" type="string">
<generator class="fr.gouv.agriculture.telepac.fw.dao.hibernate.HibernateUuidGenerator"/>
</id>

<property column="numeroIlot" name="numeroIlot" type="integer"/>
<property column="codeInseeCommuneRattach" name="idCommuneRattachement" type="string" />
<property column="codeTypeIlot" name="idTypeIlot" type="string" />
<property column="surfaceReference" name="surfaceReference" type="integer"/>
<property column="surfaceMesuree" name="surfaceMesuree" type="integer"/>
<property column="surfaceAttribuee" name="surfaceAttribuee" type="integer"/>
<property column="perimetre" name="perimetre" type="integer"/>
<property column="presenceSna" name="presenceSna" type="boolean"/>
<property column="presenceChevauchement" name="presenceChevauchement" type="boolean"/>
<!--property column="geometrie" name="geometrie" type="string" /-->
<property column="shape" name="shape" type="string"/>
<property column="objectId" name="objectId" type="integer"/>

<set name="parcelles" inverse="true" cascade="all-delete-orphan">
<key column="idIlot"/>
<one-to-many class="ParcelleCulturale"/>
</set>

<many-to-one column="idDemande" name="demande" class="DemandeAide"/>
<sql-insert>
INSERT INTO TSRFILOT (IDDEMANDE,NUMEROILOT,CODEINSEECOMMUNERATTACH,
CODETYPEILOT,SURFACEREFERENCE,SURFACEMESUREE,
SURFACEATTRIBUEE,PERIMETRE,PRESENCESNA,
PRESENCECHEVAUCHEMENT,SHAPE,OBJECTID,
IDILOT)
VALUES (?,?,?,?,?,?,?,?,?,?,ST_POLYFROMTEXT(?,1),?,?)
</sql-insert>
<sql-update>
UPDATE TSRFILOT SET SHAPE=ST_POLYFROMTEXT(?,1),OBJECTID=?,PERIMETRE=?,
SURFACEMESUREE=?,CODEINSEECOMMUNERATTACH=?,
IDDEMANDE=?,CODETYPEILOT=?,SURFACEREFERENCE=?,
PRESENCECHEVAUCHEMENT=?,SURFACEATTRIBUEE=?,
NUMEROILOT=?,PRESENCESNA=?,IDILOT=?
WHERE IDILOT=?
</sql-update>
<loader query-ref="loadIlot"/>
</class>

<sql-query name="loadIlot">
<return alias="ilot" class="Ilot" lock-mode="none" />
SELECT IDDEMANDE AS {ilot.demande},
NUMEROILOT AS {ilot.numeroIlot},
CODEINSEECOMMUNERATTACH AS {ilot.idCommuneRattachement},
CODETYPEILOT AS {ilot.idTypeIlot},
SURFACEREFERENCE AS {ilot.surfaceReference},
SURFACEMESUREE AS {ilot.surfaceMesuree},
SURFACEATTRIBUEE AS {ilot.surfaceAttribuee},
PERIMETRE AS {ilot.perimetre},
PRESENCESNA AS {ilot.presenceSna},
PRESENCECHEVAUCHEMENT AS {ilot.presenceChevauchement},
ST_ASTEXT(SHAPE) AS {ilot.shape},
OBJECTID AS {ilot.objectId},
IDILOT AS {ilot.idIlot}
FROM TSRFILOT WHERE IDILOT=?
</sql-query>


Name and version of the database you are using:Oracle 10g

Bonjour,
Je travaille avec un outil SIG qui stocke un objet dans la colonne shape.
Je voudrais mapper mon attribut ilot.shape à ST_ASTEXT(shape) pour le select et à ST_POLYFROMTEXT(ilot.shape) pour un insert ou un update.
Mon loader fonctionne correctement mais seulement lorsque je fais un select par idIlot.

Lorsque je fais un SELECT par idDemande, la requete me retourne "shape as {ilot.shape}".

De plus, je n'arrive pas faire un update.

Merci d'avance pour votre aide


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.