-->
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.  [ 1 post ] 
Author Message
 Post subject: CUSTOM NAMES FOR PRIMARY KEYS
PostPosted: Fri Jul 16, 2004 4:05 am 
Newbie

Joined: Thu Jun 24, 2004 5:53 am
Posts: 4
Hello.

I have a mapping like the following:

<hibernate-mapping>

<class name="es.tid.psstlatam.api.wgw.WGWContent" table="WGWContent">

<id name="id" type="long" unsaved-value="null">
<!--<column name="id" unique-key="PK_WGWContent"/>-->
<generator class="sequence">
<param name="sequence">WGWContent_sequence</param>
</generator>
</id>

<discriminator column="discriminator" type="string"/>

<property name="name" />
<property name="description" />
<property name="day" />
<property name="published" />
<property name="priority" />

<!-- Relations to other tables -->
<many-to-one name="site" column="WGWSite_id" class="es.tid.psstlatam.api.wgw.WGWSite"
not-null="true" foreign-key="FK_WGWContent_WGWSite"/>

<!-- Subclasses in other files -->

</class>

</hibernate-mapping>

and the generated DDL is like the following:

create table WGWContent (
id NUMBER(19,0) not null,
discriminator VARCHAR2(255) not null,
name VARCHAR2(255),
description VARCHAR2(255),
day DATE,
published NUMBER(1,0),
priority NUMBER(10,0),
WGWSite_id NUMBER(19,0) not null,
filename VARCHAR2(255),
title VARCHAR2(255),
summary VARCHAR2(255),
text VARCHAR2(255),
url VARCHAR2(255),
primary key (id)
);

I would like to assign a custom name for the primary key. How can I do this? It is possible or foreign keys using the "foreign-key" attribute of a many-to-one mapping.

Thank you, M.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.