-->
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.  [ 3 posts ] 
Author Message
 Post subject: any mapping problem
PostPosted: Tue Sep 16, 2003 5:23 am 
Newbie

Joined: Thu Aug 28, 2003 8:41 pm
Posts: 17
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
        "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>

        <class name="test.A"
              table="A"
              proxy="test.A">

                <jcs-cache usage="read-write"/>

                <id name="id" column="id" type="long">
                    <generator class="assigned">                      
                 </generator>
                </id>
               
                <any name="anyEntity" id-type="long" cascade="all">
                <column name="tableName"/>
                <column name="anyEntityId"/>
            </any>
        </class>
       
        <class name="test.B"
              table="B"
              proxy="test.B">

                <jcs-cache usage="read-write"/>

                <id name="id" column="id" type="long">
                    <generator class="assigned">                      
                 </generator>
                </id>               
        </class>
       
        <class name="test.C"
              table="C"
              proxy="test.C">

                <jcs-cache usage="read-write"/>

                <id name="id" column="id" type="long">
                    <generator class="assigned">                      
                 </generator>
                </id>               
        </class>
</hibernate-mapping>       


Code:
A a=new A();
a.setId(new Long(0));
B b=new B();
b.setId(new Long(0));

a.setAnyEntity(b);
session.save(a);

the above code is ok,but the following code
Code:
a.setAnyEntity(session.load(B.class,new Long(0)));//Entity B[0] exists
session.save(a);

the value of column a.tableName was set to be the class name of the proxy instead of the class name of test.B!

Does this mean that anyEntity can not be set with a proxy?

And it seems that the cascade of any does not work.

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 16, 2003 1:50 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
I already fixed this bug in Hibernate 2.1. Not sure if it (the fix) is in the current release, or only in the CVS snapshot.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 16, 2003 8:54 pm 
Newbie

Joined: Thu Aug 28, 2003 8:41 pm
Posts: 17
gavin wrote:
I already fixed this bug in Hibernate 2.1. Not sure if it (the fix) is in the current release, or only in the CVS snapshot.


Thanks a lot!
I made a mistake, the cascade of any does work!


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

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.