-->
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.  [ 8 posts ] 
Author Message
 Post subject: Name index on PK
PostPosted: Mon Nov 14, 2005 7:48 am 
Beginner
Beginner

Joined: Tue Feb 15, 2005 8:14 am
Posts: 32
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.0.5

I make use of xdoclet. Can I decide the name of my index on the PK field on a table.

My xdoclet tag lookes like this :

/**
* Returns the id.
*
* @hibernate.id
* column="ID"
* type="long"
* generator-class="native"
*
* @return the id.
*/
public Long getId() {
return id;
}

My db2 then generate a index with a generated name, but I would like to name this index myself.

The same thing applys to the unique="true" on ther columns


Top
 Profile  
 
 Post subject: DDL
PostPosted: Mon Nov 14, 2005 9:22 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
I guess you are trying to use auto schema generation. I would not recommend doing so, it is better to generate DB Schema from DDL.
Schema check at startup significantly increases the startup time, which is inconvenient for development and does not produce optimal DB schema because
Hibernate mapping does not seem to have a way to define PK index name and alike and for good reasons IMO.

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


Top
 Profile  
 
 Post subject: PK constraint name
PostPosted: Tue Nov 15, 2005 10:21 am 
Newbie

Joined: Tue Nov 15, 2005 10:05 am
Posts: 9
What good reasons are they?
I'm not sure, are you saying that theres no way to name the PK constraints/indexs when generating DDL from the hbm.xml mapping file? The default SYS_Cnnnnnnnnn names generated by Oracle cause a real headache for our support.
Looking at the DTD there's nothing useful I can add to the <id/> element, but if you could point out something I'm missing I'd be very happy.
Thanks
Mike


Top
 Profile  
 
 Post subject: imo
PostPosted: Tue Nov 15, 2005 12:41 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
Yes, hbm DDL does not define any provisions for PK names and other constraints.

Good reasons IMO: H is the tool to map _data_ between object model and relational database – it is not a tool to manage database schema. Personally I am disappointed that H even tries to do so.
DB schema should be done professionally, in the database specific way. Please look at tools like ErWin or DeZign to help you with DB Schema management.

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 15, 2005 1:19 pm 
Newbie

Joined: Tue Nov 15, 2005 10:05 am
Posts: 9
I do see what you're saying, however I think you're thinking in ideal terms rather than 'what gets the job done'.
I'm more interested in engineering solutions and if one tool can manage the persistance layer and generate the schema to match it then it's got to be better than generating the two separately and tweaking them until they match.
It appears to me that for any given data model Hibernate does have a preferred schema design and it makes sense to me that hibernate be the tool to tell you what that is.
While there is a fair amount of flexibility over the mapping, when we ported to Hibernate we did find it advantagious to change the database schema to match what worked best with it. Although we use code generation to do allmost all of this job, generating the schema and the mapping file separately would have been much more work than creating one from the other.

just my 2p, I'm not deliberately trolling.

Mike


Top
 Profile  
 
 Post subject: 2c
PostPosted: Tue Nov 15, 2005 1:28 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
IMO letting H generate less than desirable schema is not that I call: getting job done.
And managing DDL in a separate tool is not that hard. There is video footage (~7 min) on my site that shows how I do it
http://kgionline.com/presentations/agil ... ile_db.jsp

But, as usual, you make your own decision. Apparently there is enough people think that H should generate schema.

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


Top
 Profile  
 
 Post subject: Re: imo
PostPosted: Thu Nov 17, 2005 2:33 pm 
Newbie

Joined: Tue Nov 15, 2005 8:27 pm
Posts: 19
Location: Columbia, MO USA
kgignatyev wrote:
DB schema should be done professionally, in the database specific way. Please look at tools like ErWin or DeZign to help you with DB Schema management.


Are there any good open-source tools out there that do the same thing as ErWin or DeZign?


Top
 Profile  
 
 Post subject: OpenSource ErWin analog
PostPosted: Thu Nov 17, 2005 2:44 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
As far as I know there is no good OpenSource tool for Database Management.

I tried http://www.thekompany.com/products/dataarchitect/
Couple of years ago but did not like it, they might well improve it now.

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


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