-->
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.  [ 7 posts ] 
Author Message
 Post subject: proxy with composite-id
PostPosted: Thu Dec 18, 2003 10:37 am 
Beginner
Beginner

Joined: Thu Dec 11, 2003 9:54 am
Posts: 25
Guys,

could somebody tell me is there any possibility to use proxy/lazy stuff with composite-id ?

Like an example: I have Table1 which have some fields and composite-id. Composite-id consist from 2 fields: one is local, other is foreign key.

Now, I'd like to catch some data from Table1, but Hibernate (2.1 final) ask automatically PK-table, and tries to build full object. How I can turn off such Hibernat's behaviour ?

-awt


Top
 Profile  
 
 Post subject: Re: proxy with composite-id
PostPosted: Thu Dec 18, 2003 10:48 am 
Beginner
Beginner

Joined: Thu Dec 11, 2003 9:54 am
Posts: 25
awt wrote:
Guys,

could somebody tell me is there any possibility to use proxy/lazy stuff with composite-id ?

Like an example: I have Table1 which have some fields and composite-id. Composite-id consist from 2 fields: one is local, other is foreign key.

Now, I'd like to catch some data from Table1, but Hibernate (2.1 final) ask automatically PK-table, and tries to build full object. How I can turn off such Hibernat's behaviour ?

-awt


forgot to say, this FK is many side of many-to-one relation...

-awt


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 18, 2003 12:27 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Don't see any fundamental reason why it's not doable. Do you set a CompositeClass in <composite-id> ?

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 18, 2003 1:00 pm 
Beginner
Beginner

Joined: Thu Dec 11, 2003 9:54 am
Posts: 25
Thanks, for your reply...

epbernard wrote:
Don't see any fundamental reason why it's not doable. Do you set a CompositeClass in <composite-id> ?


Yes, I'm; actually have done this by Middlegen, version r-3, here are a piece of .hbm.xml:

Code:
    <composite-id name="comp_id" class="FirstPK">
        <key-property
            name="Id"
            column="ID"
            type="java.math.BigDecimal"
            length="22"
        />
        <!-- bi-directional many-to-one association to User -->
        <key-many-to-one
           name="user"
           class="User"
       >
           <column name="USER_ID" />
       </key-many-to-one>
    </composite-id>   


The question is: How I can catch a data from Table1, without calling to table at "one" or PK end ?
(well... yeah, it's a kind of tuning...)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 19, 2003 5:00 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Have you selected the option to set up the class proxy for each of the tables you want lazy loaded?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 19, 2003 5:35 am 
Beginner
Beginner

Joined: Thu Dec 11, 2003 9:54 am
Posts: 25
david wrote:
Have you selected the option to set up the class proxy for each of the tables you want lazy loaded?


Yes, for normal FK, it is completely OK.
But with Composite-Id (my case, see above) seems, that it (proxy on PK table) doesn't work. Or I have some mistakes, but where ?

-awt


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 20, 2003 11:35 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
User mappings should have a proxy on it. If it does and its not working then a small example would need to be created to illustrate the problem.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 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.