Hi,

first of all, currently hibernate cartridge is not mapping compositions (as they should be done with the "component" element... the good news about this, is that I plan to do before March 14th).

On the other hand, and based on the information you give on the mail, I think that the cartridge is doing what it is supposed to do, let me explain it:

When there is a one to one association, the cartridge will map the relation with a <one-to-one> element on one side, and a <many-to-one> on the other. Hibernate cartridge decides where to use <one to one> or <many to one>, if one of the sides is declared primary.
Here is an extract of the templates:

#if ($sourceEnd.one2One)
#if ($sourceEnd.one2OneSecondary)
        <one-to-one name="$otherEnd.name"  ......
#else
#if($sourceEnd.one2OnePrimary)
        <many-to-one name="$otherEnd.name" .....
            <column name="$otherEnd.columnName"/>
        </many-to-one>
#else
        <one-to-one name="$otherEnd.name" .......
#end
#end

Secondary means: the foreign key is not specified on this one-to-one association within the hibernate one-to-one mapping.
Primary means:  it will be the one containing the foreign key column definition. (the other end contains the Aggregation or composition)

Also lazy attribute should not be mapped any of these sides (please refer to hibernate-mappings dtd).

I hope this can help you

regards

Carlos

Wouter Zoons wrote:
you're right, it should be a one-on-one .. the foreign key should not be
there

strange indeed, I'm using the same construct in my own models and it's
working fine .. perhaps this bug has been introduced last night ?

Carlos, could you verify Bernard's issue too ? I'm reluctant to update
from the Maven repo because I'm in a critical phase in my project.

thanks
-- Wouter

  
Thank you for the MaxFetchDepth pointer. Now for the
aggregation/composition issue, I am well aware that
setting an association's type to "composition" will
eagerly load its dependent objects, unless you specify
it to be lazy explicitely using a tag value.

ok, I have an association between a User entity and a
Rolodex Entity. It is a composition, which to me
implies a black diamond on the User side of the
relation.

Both ends of the relation have a 1 multiplicity.

here's what andromda generates:

        <many-to-one name="rolodex"
class="fractals.psychos.core.pim.entity.RolodexImpl"
outer-join="auto" unique="true" not-null="false"
cascade="delete">
            <column name="ROLODEX_FK"/>
        </many-to-one>

I have specified  @andromda.hibernate.lazy on BOTH
ends of the relation, just to be sure.

not only is the "lazy" attribute missing, but, ok I
may be naive, but this isn't a many-to-one
association, but a 1-to-1 association.

can somebody please explain this to me?

bernard

--- Wouter Zoons <[EMAIL PROTECTED]> wrote:
    
I can't figure out how to tell hibernate NOT to
eagerly load relations. It seems to be completely
ignorant of the "lazy=true" attribute.

        
it is not

bottom of this page:

      
http://team.andromda.org/docs/andromda-spring-cartridge/howto2.html
    
(compositionDefinesEagerLoading)

      
http://team.andromda.org/docs/andromda-hibernate-cartridge/namespace.html
    
So, as a last resort, as is stated there, I'd like
        
to
      
try setting max_fetch_depth to 1 or 2, only I
        
don't
      
know how to let AndroMDA specify that.

        
(hibernateMaxFetchDepth)

      
http://team.andromda.org/docs/andromda-hibernate-cartridge/namespace.html
    
-- Wouter


      


__________________________________
Celebrate Yahoo!'s 10th Birthday!
Yahoo! Netrospective: 100 Moments of the Web
http://birthday.yahoo.com/netrospective/


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Andromda-user mailing list
Andromda-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/andromda-user

    




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
Andromda-user mailing list
Andromda-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/andromda-user


  

Reply via email to