-->
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: relationship bidirectionnelle + second level cache
PostPosted: Mon Jul 06, 2009 10:17 am 
Newbie

Joined: Tue May 12, 2009 5:54 am
Posts: 9
Hi,
when i'm enable second level cache, i've a problem

2 entities :

abonnement
Code:
<?xml version="1.0" encoding="UTF-8"?>
<hibernate-mapping
    xmlns="urn:nhibernate-mapping-2.2"
    default-cascade="none">

    <class
        name="...."
        table="ABONNEMENT"
        dynamic-insert="false"
        dynamic-update="false"
        lazy="true">

        <cache usage="read-write" />
        <id name="Id" type="Int64" unsaved-value="0">
            <column name="ID" sql-type="BIGINT"/>
            <generator class="native">
            </generator>
        </id>

   ........

        <many-to-one name="Commande" class="Fr.Cned.AtoutCned.Dispositif.Entites.Collectivites.BonDeCommande, Fr.Cned.AtoutCned.Dispositif.Core" outer-join="auto" cascade="none" foreign-key="ABONNEMENT_COMMANDE_FKC">
            <column name="COMMANDE_FK" not-null="false" sql-type="VARCHAR(255)"/>
        </many-to-one>

        .......

    </class>

</hibernate-mapping>


bon de commande
Code:
<?xml version="1.0" encoding="UTF-8"?>
<hibernate-mapping
    xmlns="urn:nhibernate-mapping-2.2"
    default-cascade="none">

    <class
        name="..."
        table="BON_DE_COMMANDE"
        dynamic-insert="false"
        dynamic-update="false"
        lazy="true">

        <cache usage="read-write" />
        <id name="Numero" type="String" unsaved-value="null">
            <column name="NUMERO" sql-type="VARCHAR(255)"/>
            <generator class="assigned">
            </generator>
        </id>

        <set name="Abonnements" order-by="COMMANDE_FK" lazy="true" outer-join="auto" inverse="true" cascade="delete">
            <cache usage="read-write" />
            <key foreign-key="ABONNEMENT_COMMANDE_FKC">
                <column name="COMMANDE_FK" sql-type="VARCHAR(255)"/>
            </key>
            <one-to-many class="Abonnement"/>
        </set>
....

    </class>
    <!-- NHibernate.hbm.xml.vsl merge-point -->
</hibernate-mapping>


I define one object abonnement in bondecommande.
abo.commande = bondecommande
When i call bondecommande.commandes, it has not changed.
i had not this problem if second level cache is disable.
Why ?
Thanks Arno.


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.