[jbosstools-issues] [JBoss JIRA] Commented: (JBIDE-5628) reverse engineer tool should add attribute 'catalog' in element 'set' when creating *.hbm.xml files

Max Rydahl Andersen (JIRA) jira-events at lists.jboss.org
Tue Feb 9 12:34:19 EST 2010


    [ https://jira.jboss.org/jira/browse/JBIDE-5628?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12511322#action_12511322 ] 

Max Rydahl Andersen commented on JBIDE-5628:
--------------------------------------------

Dmitry, i've committed a new batch which fixes it for the collection types your patch lists. Extracted the common code so the horrible freemarker check for double null does not have to be reproduced in every file.

> reverse engineer tool should add attribute 'catalog' in element 'set' when creating *.hbm.xml files
> ---------------------------------------------------------------------------------------------------
>
>                 Key: JBIDE-5628
>                 URL: https://jira.jboss.org/jira/browse/JBIDE-5628
>             Project: Tools (JBoss Tools)
>          Issue Type: Bug
>          Components: Hibernate
>    Affects Versions: 3.0.3.GA
>         Environment: Eclipse 3.4.2, MySQL 5.1, JBoss 5.1, Windows XP
>            Reporter: Pieter Hartog
>            Assignee: Dmitry Geraskov
>            Priority: Minor
>             Fix For: 3.1.0.CR2
>
>         Attachments: collection table attributes.patch, JIRA_5628_MySQL_Catalog.sql, src.zip, src.zip
>
>
> When you reverse engineer a MySQL database, in which one many-to-many relationship exists, it creates an entry in the *.hbm.xml file for the referencing table, for example this:
>         <set name="roles" inverse="false" lazy="true" table="user_roles"  fetch="select">
>             <key>
>                 <column name="userId" not-null="true" />
>             </key>
>             <many-to-many entity-name="org.domain.helloseamdata.entity.Role">
>                 <column name="roleId" not-null="true" />
>             </many-to-many>
>         </set>
> Note that the attribute 'catalog' is not present in the element 'set'.
> Now if you try to deploy this to a server, and the property 'hibernate.default_catalog' is NOT set in the persistence.xml file (so the server doesn't know which catalog to choose), you'll get an error like this:
> 21:54:47,281 INFO  [TableMetadata] table found: maintenance.user
> 21:54:47,281 INFO  [TableMetadata] columns: [enabled, username, userid, lastname, firstname, passwordhash]
> 21:54:47,281 INFO  [DatabaseMetadata] table not found: user_roles
> 21:54:47,281 ERROR [AbstractKernelController] Error installing to Start: name=persistence.unit:unitName=HelloSeamData-ear.ear/HelloSeamData-ejb.jar#HelloSeamData state=Create
> javax.persistence.PersistenceException: [PersistenceUnit: HelloSeamData] Unable to build EntityManagerFactory
> 	at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677)
> I think that the reverse engineering tool should put the catalog name in the *.hbm.xml file in the element 'set'.
> When I add it manually, resulting in this:
>         <set name="roles" inverse="false" lazy="true" table="user_roles"     catalog="maintenance"       fetch="select">
>             <key>
>                 <column name="userId" not-null="true" />
>             </key>
>             <many-to-many entity-name="org.domain.helloseamdata.entity.Role">
>                 <column name="roleId" not-null="true" />
>             </many-to-many>
>         </set>
> the deployment works fine.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jbosstools-issues mailing list