]
Dmitry Geraskov updated JBIDE-5628:
-----------------------------------
Attachment: collection table attributes.patch
Max, I also fixed this today and seems you forgot about the rest collections. In the patch
they are have the attribut too.
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: