Discussion:
[jboss-user] [JBoss Tools] - Re: JPA reverse engineer & MySQL
reskejal
2013-04-19 23:06:42 UTC
Permalink
reskejal [https://community.jboss.org/people/reskejal] created the discussion

"Re: JPA reverse engineer & MySQL"

To view the discussion, visit: https://community.jboss.org/message/809365#809365

--------------------------------------------------------------
Any news about this topic??
I have the same problem with stable release of jboss developer studio (6.0).
In my case the error is only for the validator because i can use the genereted class without problem.
i'm also able to fix the error but i need remove manually the catalog definition and have an annotation like this
@Table(name = "F")
and default values (in JPA property windows) are "Default" for catalog and "Default (sample2)" for schema
Also with this fix my project work.

In jboss dev studio i have a Database Connection like jdbc:mysql://localhost:3306/sample2
while on AS and in persistence.xml use data source with jta  (connection string is always like jdbc:mysql://localhost:3306/sample2)

Is there a way to not generate the catalog attribute in annotation ??

Thanks.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/809365#809365]

Start a new discussion in JBoss Tools at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2128]
Gerry Matte
2013-04-20 06:09:00 UTC
Permalink
Gerry Matte [https://community.jboss.org/people/gerry.matte] created the discussion

"Re: JPA reverse engineer & MySQL"

To view the discussion, visit: https://community.jboss.org/message/809376#809376

--------------------------------------------------------------
This behavior has been standard for MySQL and hibernate from the beginning.    I belive the MySQL driver interprets a database schema the same as an Oracle catalog .... but a MySQL catalog has subtle differences from a schema and does not play well with hibernate. 

My standard fix up (workaround) is to immediately remove the catalog property.  I most frequently use Forge to reverse engineer and generate a CRUD webapp ..... so it's become routine for me.  Thanks to Eric for reporting the issue .... I should have done so long ago.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/809376#809376]

Start a new discussion in JBoss Tools at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2128]
Max Rydahl Andersen
2013-04-22 07:41:49 UTC
Permalink
Max Rydahl Andersen [https://community.jboss.org/people/maxandersen] created the discussion

"Re: JPA reverse engineer & MySQL"

To view the discussion, visit: https://community.jboss.org/message/809501#809501

--------------------------------------------------------------
set hibernate.default_catalog and hibernate.default_schema and the reverse engineering will obey that and remove it.

If someone know of a way to reliably know from a jdbc connection which schema/catalog is the default then we could avoid this, but I haven't found a way that is sane.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/809501#809501]

Start a new discussion in JBoss Tools at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2128]
reskejal
2013-04-22 20:26:14 UTC
Permalink
reskejal [https://community.jboss.org/people/reskejal] created the discussion

"Re: JPA reverse engineer & MySQL"

To view the discussion, visit: https://community.jboss.org/message/809671#809671

--------------------------------------------------------------
Thanks for yours suggestions!
@Gerry many thanks...Forge its a great project.
@Max i try to set these properties in persistence.xml and in the optional parameters of the database connection..but with no luck, i have always the catalog annotation :(
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/809671#809671]

Start a new discussion in JBoss Tools at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2128]
Max Rydahl Andersen
2013-04-25 10:38:35 UTC
Permalink
Max Rydahl Andersen [https://community.jboss.org/people/maxandersen] created the discussion

"Re: JPA reverse engineer & MySQL"

To view the discussion, visit: https://community.jboss.org/message/810266#810266

--------------------------------------------------------------
hmm - it should just work.

Can you show me the generated code and the persistence.xml you are using ?
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/810266#810266]

Start a new discussion in JBoss Tools at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2128]
Loading...