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

Márcio Sugar (JIRA) jira-events at lists.jboss.org
Fri Feb 5 14:20:19 EST 2010


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

Márcio Sugar commented on JBIDE-5628:
-------------------------------------

Same problem here with Oracle 9i. I mean, the Hibernate reverse engineering tool is not adding the needed "schema" attribute to the many-to-many "set" entries in the *.hbm.xml files.

My application needs to talk to 3 different "schemas" (or "owners" in Oracle parlance), so the proposed workaround is not enough. Because of this I need to have all those missing "schemas" attributes set by hand. (That it's a lot of work and compromises the very purpose of the tool, IMHO).

Another workaround would be to create public synonyms in the database, but this is not always an option. (DBA policies, you know...)

My configuration is:

HibernateTools-3.2.4.GA-R200905070146-H18.zip
hibernate-distribution-3.3.2.GA-dist.tar.gz
Eclipse 3.5.1
Java 1.6.0_13
Linux (CentoOS 5)


> 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: 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