-->
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.  [ 2 posts ] 
Author Message
 Post subject: one-to-one
PostPosted: Thu Jan 27, 2005 2:58 pm 
Newbie

Joined: Tue Jan 25, 2005 11:53 am
Posts: 8
hi,

i have a one-to-one association:
Code:
<class name="ambar.modelo.cuenta.CuentaPeriodo" table="cuenta_periodo">
    <id name="id" column="id" unsaved-value="-1">
   <generator class="sequence">
            <param name="sequence">sc_cuenta_periodo</param>
        </generator>
    </id>
.....
<one-to-one name="liquidacion" class="ambar.modelo.cuenta.LiquidacionConsumo"/>
...</class>


and in CuentaPeriodo.java i have an object liquidacion of type ambar.modelo.cuenta.LiquidacionConsumo

but i don´t want to have in LiquidacionConsumo.java an object cuentaPeriodo

so this mapping doesn´t work:
Code:
   <class name="ambar.modelo.cuenta.LiquidacionConsumo" table="liquidacion_consumo">
    <id name="id" column="id">
   <generator class="foreign">
            <param name="property">id</param>
        </generator>
    </id>
.....
    <one-to-one name="id" class="ambar.modelo.cuenta.CuentaPeriodo" property-ref="liquidacion"/>
...</class>


i don´t know if i´m clear enough if i´m not please let me know.

thanks everyone for any help,

Juan Gabriel Romero Silva


Top
 Profile  
 
 Post subject: one-to-one generator "assigned"
PostPosted: Fri Jan 28, 2005 1:19 pm 
Newbie

Joined: Tue Jan 25, 2005 11:53 am
Posts: 8
Searching at the reference documentation i found the Author/Work Example(18.2). There is an one-to-one association like i need:

Code:
<class name="Author" table="authors">
  <id name="id" column="id">
  <!-- The Author must have the same identifier as the Person -->
    <generator class="assigned"/>
  </id>
..</class>


But here is used the generator "assigned".

I´ve read about it and i understand i have to use programmatic means to assigned a value to id. I´m wrong?. In any case, where do i assign a value to this id??

thanks, thanks

Juan Gabriel Romero Silva


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