-->
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.  [ 4 posts ] 
Author Message
 Post subject: PostgreSQL reverse engering and 'serial' data type
PostPosted: Mon Dec 18, 2006 10:16 pm 
Newbie

Joined: Mon Dec 18, 2006 10:06 pm
Posts: 2
Hi everybody,

I have problem with Hibernate Tools. I try with version 3.2.0 in Eclipse.

I'm trying to reverse my PostgreSQL database (version 8.2). The problem is in generating "generator" tag in mapping xml file. Hibernate Tools generating always:
Code:
<generator class="assigned" />

All id columns in my tables are 'serial' data type. That means each one use sequence. How can I configure Hibernate Tools to generate "sequence" type in "generator" tag? Can Hibernate find also the name of the sequnce and put as param to this tag?

Best regards,

Kuba Królikowski


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 19, 2006 6:14 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
see docs about how to configure primarykey in reveng.xml

or more generally in the reverse engineering strategies.

i do not think sequence is associated with serial, if there is then contributions are welcome ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 19, 2006 7:57 pm 
Newbie

Joined: Mon Dec 18, 2006 10:06 pm
Posts: 2
But how to configure reverse engering strategies to retrieve sequence name from database for given column of serial type?

Serial is always associated with sequence:
http://www.postgresql.org/docs/7.4/inte ... YPE-SERIAL

Kuba


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 20, 2006 3:19 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
But hibernate does not need to use the sequence name since postgresql automatically assigns it.

If you still want that then implement the logic (which is postgresql specific) in ReverseEngineeringStrategy methods such as:

public String getTableIdentifierStrategyName(TableIdentifier identifier);
public Properties getTableIdentifierProperties(TableIdentifier identifier);

_________________
Max
Don't forget to rate


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