-->
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: MiddleGen composite-id
PostPosted: Wed Aug 24, 2005 2:44 pm 
Newbie

Joined: Wed Aug 24, 2005 2:27 pm
Posts: 3
My question is: MiddleGen automatically creates this TbServicoDncPK, it´s another class when i use CodeGen.My code becomes more complex. so.... continues after the listed code

<class name="com.ccne.bo.TbServicoDnc" table="TB_SERVICO_DNC">

<composite-id name="comp_id" class="com.ccne.bo.TbServicoDncPK">

<key-property name="codTipoFamiliaInsumo" column="COD_TIPO_FAMILIA_INSUMO" type="byte" length="2"/>

<key-property name="codDependencia" column="COD_DEPENDENCIA" type="int" length="10"/>

<key-property name="codFamiliaDnc" column="COD_FAMILIA_DNC" type="int" length="10"/>

<key-property name="codServicoDnc" column="COD_SERVICO_DNC" type="int" length="10"/>

</composite-id>

i´m erasing this PK classes like this:

....

<composite-id >

.....

It has no name and i erase the class ..PK too.I work with many composite-id´s is it ok what i´m doing?

thanks in advance


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 24, 2005 8:20 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Tools forum would have been better - lucky I spotted it .

----

Middlegen can create mappings for Composite keys in two formats that are support by Hibernate. The best format is the one you have show which it the external composite key. You could choose to have the integrated composite key generated instead. Deleting the composite key mapping section would appear to be wrong as you now have no key for the relational table. A key is required. You did not say why (,other than complexity,) you are removing the key form the entity mapping.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 24, 2005 8:22 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
BTW: There is a simple Ant attribute that can be used to change the composite key generation style. I think this is what what you want to do.


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.