[jboss-jira] [JBoss JIRA] (HIBERNATE-128) Hibernate tools generate wrong sequence when using multiple table-filters

Gonzalo Aguilar (JIRA) jira-events at lists.jboss.org
Fri Feb 17 16:12:36 EST 2012


Gonzalo Aguilar created HIBERNATE-128:
-----------------------------------------

             Summary: Hibernate tools generate wrong sequence when using multiple table-filters
                 Key: HIBERNATE-128
                 URL: https://issues.jboss.org/browse/HIBERNATE-128
             Project: Hibernate Integration
          Issue Type: Bug
         Environment: Linux red1 3.0.0-16-generic #28-Ubuntu SMP Fri Jan 27 17:44:39 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
/usr/lib/jvm/java-6-openjdk/jre/bin/java
Hibernate Tools 3.4.0.CR1
Eclipse Indigo
            Reporter: Gonzalo Aguilar
            Assignee: Steve Ebersole


Hibernate tools (reverse engineering) is creating wrong sequence number when using different table-filters.

I also think that some interface with eclipse is doing bad things to file cache.

First:

Sequence generation is not generated correctly when using schema tag on table with some table-filters. Example

<hibernate-reverse-engineering>
...
	<table-filter match-name="lead" match-schema="public" exclude="false" />
	<table-filter match-name="contact_.*" match-schema="public" exclude="false" />
...

	<table name="contact_record" schema="public">
		<primary-key>
			<generator class="sequence">
				<param name="table">contact_record_id_contact_record_seq</param>
			</generator>
		</primary-key>
<!-- 		<column name="uuid"	type="com.level2.enterprise.crm.hibernate.datatypes.UuidUserType" /> -->
	</table>

</hibernate-reverse-engineering>

---> RESULT WRONG!!!! it performs a generator="assigned"


<hibernate-reverse-engineering>
...
	<table-filter match-name="lead" match-schema="public" exclude="false" />
	<table-filter match-name="contact_.*" match-schema="public" exclude="false" />
...

	<table name="contact_record">
		<primary-key>
			<generator class="sequence">
				<param name="table">contact_record_id_contact_record_seq</param>
			</generator>
		</primary-key>
<!-- 		<column name="uuid"	type="com.level2.enterprise.crm.hibernate.datatypes.UuidUserType" /> -->
	</table>

</hibernate-reverse-engineering>

---> RIGHT!! BUT YOU HAVE TO SEE THE SCREENSHOT...  IT DOES NOT GET UPDATED IN ECLIPSE

This creates something like in eclipse. No matter what you do (refresh, close and open again, etc):

<?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 17-feb-2012 21:32:52 by Hibernate Tools 3.4.0.CR1 -->
<hibernate-mapping>
    <class name="com.level2.enterprise.hibernate.generated.ContactRecord" table="contact_record">
        <id name="idContactRecord" type="java.lang.Integer">
            <column name="id_contact_record" />
            <generator class="assigned" />
        </id>
----


But in the file if you see with a less command you get: 
<?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 17-feb-2012 21:49:17 by Hibernate Tools 3.4.0.CR1 -->
<hibernate-mapping>
    <class name="com.level2.enterprise.hibernate.generated.ContactRecord" table="contact_record">
        <id name="idContactRecord" type="java.lang.Integer">
            <column name="id_contact_record" />
            <generator class="sequence">
                <param name="table">contact_record_id_contact_record_seq</param>
            </generator>
        </id>
------

That is right.



Second:


I also got a GUI problem when reversing this:


	<table name="contact_record">
		<primary-key>
			<generator class="sequence">
				<param name="table">contact_record_id_contact_record_seq</param>
			</generator>
		</primary-key>
<!-- 		<column name="uuid"	type="com.level2.enterprise.crm.hibernate.datatypes.UuidUserType" /> -->
	</table>


if the commented section is enabled (uncommented). That is wrong because types does not match but it should do something and tell you that's wrong. Instead it just crashes. The only way to make it work was adding schema to table:

	<table name="contact_record" schema="public">
		<primary-key>
			<generator class="sequence">
				<param name="table">contact_record_id_contact_record_seq</param>
			</generator>
		</primary-key>
	<column name="uuid"	type="com.level2.enterprise.crm.hibernate.datatypes.UuidUserType" />
	</table>

But it got the sequence wrong again. 

That was really weird...


Hope it helps


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list