-->
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: How to exclude index field from primary key for hbm2ddl
PostPosted: Fri Feb 06, 2004 9:46 am 
Newbie

Joined: Fri Feb 06, 2004 9:05 am
Posts: 7
Location: Russia, Moscow
Hi!

We use Hibernate 2.1.

This is part of my mapping document:

Code:
<class name="com.orionbilling.server.model.account.Subscription" table="subscription">

<id name="id" column="id" type="java.lang.Long">
  <generator class="native">
</id>

<map name="networkIdentifiers" table="network_identifier">

   <key column="subscription_id"/>

   <index type="com.orionbilling.common.TimeIntervalType">
    <column name="start_date"/>
    <column name="end_date"/>
   </index>

   <composite-element class="com.orionbilling.server.model.account.NetworkIdentifier">
    <property name="imsi" type="string" column="imsi"/>
    <property name="phoneNumber" type="string" column="phone_number"/>
   </composite-element>
</map>
...
</class>


Schema export tool generates for NetworkIdentifier component such table:

Code:
create table network_identifier (
   subscription_id NUMBER(19,0) not null,
   imsi VARCHAR2(15),
   phone_number VARCHAR2(15),
   start_date DATE not null,
   end_date DATE not null,
   primary key (subscription_id, start_date, end_date)
);


but by our business requirements 'end_date' can be null and it is not necessary to be it in the primary key of 'network_identifier' table. Is their some way to specify that 'end_date' column shouldn't be included in the part of 'network_identifier' primary key? I understand that my case is a pretty exotic, but may be I missed something in the documentation or Hibernate examples and it's possible to do.

Best Regards,
Den Orlov


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 06, 2004 10:37 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Send this to JIRA.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 07, 2004 8:37 am 
Newbie

Joined: Fri Feb 06, 2004 9:05 am
Posts: 7
Location: Russia, Moscow
david wrote:
Send this to JIRA.


Done


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.