-->
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.  [ 2 posts ] 
Author Message
 Post subject: Cannot make reveng create a sequence in the table. [BUG??]
PostPosted: Wed Feb 15, 2012 6:52 am 
Beginner
Beginner

Joined: Tue Oct 20, 2009 6:28 am
Posts: 20
Hello,

I'm getting strange behavior. I'm doing reverse code generation using hibernate tools.
Normally it works perfectly but sometimes it does not applies right the config, for example:

I have this in my reveng.xml file:

NIOTE: Color tag not recognized in the forum inside CODE tag.
Code:
<table name="contact_type" schema="public">
<primary-key>
<generator class="sequence">
<param name=[color=#FFFF00]"sequence"[/color]>contact_type_id_contact_type_seq</param>
</generator>
<key-column name="id_contact_type" />
</primary-key>
</table>



The sequence is not generated correctly:

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated 15-feb-2012 0:59:59 by Hibernate Tools 3.4.0.CR1 -->
<hibernate-mapping>
    <class name="com.level2.enterprise.hibernate.generated.ContactType" table="contact_type">
        <id name="idContactType" type="java.lang.Integer">
            <column name="id_contact_type" />
            <generator class="[color=#FFFF00]assigned[/color]" />
        </id>
        <many-to-one name="contactTypeCategory" class="com.level2.enterprise.hibernate.generated.ContactTypeCategory" fetch="select">
            <column name="id_contact_type_category" not-null="true" />
        </many-to-one>
        <property name="contactTypeDescription" type="string">
            <column name="contact_type_description" length="50" not-null="true" />
        </property>
        <set name="contactRecords" table="contact_record" inverse="true" lazy="true" fetch="select">
            <key>
                <column name="id_contact_type" not-null="true" />
            </key>
            <one-to-many class="com.level2.enterprise.hibernate.generated.ContactRecord" />
        </set>
    </class>
</hibernate-mapping>


The strange thing here is that sometimes it gets generated correctly. The exact use case is still not determined but I can say that doing things in eclipse like opening the class, closing the file, etc. Affects the result.

I also have seen sometimes and in documentation that param is configured differently:

<param name="table">contact_type_id_contact_type_seq</param>

I tried both configuration but it seems to do same thing.

I've also checked my database permissions. And set even a GRANT ALL ... TO PUBLIC; to everything. But makes not difference.

My problem is that I get not consistent code. And some code is failing because no sequence defined so I have to put nextval manually.

Can someone point me to the right direction?

Why the sequence is not recognized?

Is this configuration right?

How can I force the sequence being generated right?

Thank you in advance.


Top
 Profile  
 
 Post subject: Re: Cannot make reveng create a sequence in the table. [BUG??]
PostPosted: Fri Feb 17, 2012 5:12 pm 
Beginner
Beginner

Joined: Tue Oct 20, 2009 6:28 am
Posts: 20
Hello,

I had to open a bug:

https://issues.jboss.org/browse/HIBERNATE-128


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