-->
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.  [ 5 posts ] 
Author Message
 Post subject: Changing the column parameters of a Key / ID column
PostPosted: Sun Oct 05, 2003 8:22 pm 
Newbie

Joined: Sun Oct 05, 2003 5:43 pm
Posts: 10
Location: Atlanta
Does any one know how to change the column information on an ID field. We have a legacy system that uses Oracle, and we currently key most of our objects with a Number(38). The schema tool generates Number(19,0) for id fields. I have tried using a property but that did not work.

Any ideas?

Mike...


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 05, 2003 9:56 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Its documented for Properties only though it works fine for IDs, eg, use the sql-type attribute of the column. For example;

<id name="id" type="long" unsaved-value="null" >
<column name="id" sql-type="NUMBER(38)" />
<generator class="native"/>
</id>


Top
 Profile  
 
 Post subject: Did not work?
PostPosted: Sun Oct 05, 2003 11:15 pm 
Newbie

Joined: Sun Oct 05, 2003 5:43 pm
Posts: 10
Location: Atlanta
I tried what you suggested ...

<class name="com.pts.ietms.data.om.DataDomain" table="DataDomain">
<id name="id" type="long" column="id">
<column name="id" sql-type="NUMBER(38)"/>
<generator class="hilo"/>
</id>
<property name="description" column="description" type="string"/>
<property name="refId" column="refId" type="string"/>
</class>

but it produced ....

] create table DataDomain (
] id NUMBER(19,0) not null,
] description VARCHAR2(255),
] refId VARCHAR2(255),
] primary key (id)
] );

The class definition is:

public class DataDomain
{

private Long id;
private String description;
private String refId;

public DataDomain()
{
}

public Long getId()
{
return id;
}

public void setId(Long id)
{
this.id = id;
}

....

}

Any ideas?

Mike...


Top
 Profile  
 
 Post subject: Got it....
PostPosted: Sun Oct 05, 2003 11:29 pm 
Newbie

Joined: Sun Oct 05, 2003 5:43 pm
Posts: 10
Location: Atlanta
<id name="id" type="long" >
<column name="id" sql-type="NUMBER(38)"/>
<generator class="hilo"/>
</id>

works ...

<id name="id" type="long" column="id">
<column name="id" sql-type="NUMBER(38)"/>
<generator class="hilo"/>
</id>
did not ...

so I guess have a column attribute must make the system ignore a column enclosed entity.....

Thanks...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 06, 2003 4:31 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
The column tag describes the sql column while the id type attribute is the hibernate type to use which is then mapped to Java using the database dialect. Its also a case of first found is used first. Gald you worked it out.


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